<?php

namespace  App\Http\Requests\OpenWork\Media;

use App\Http\Requests\BaseRequest;

/**
 * 素材管理接口校验规则
 * @author  唐远望
 * @date    2025-04-07
 * */
class Upload extends BaseRequest
{

    /**
     *
     * @return  array
     */
    public  function  rules()
    {
        // 规则
        return [
            'corpid'              => 'required',
            'file'         => 'required|file',
            'media_id'         => 'required',
            'scene'         => 'required',
            'type'         => 'required',
            'filename'         => 'required',
            'url'         => 'required',
            'md5'         => 'required',
        ];
    }

    // 场景列表
    protected   $scenes         = [
        'uploadimg'                      => ['corpid', 'file'],
        'uploadmedia'                    => ['corpid', 'file'],
        'getmedia'                    => ['corpid', 'media_id'],
        'getvoicemedia'                    => ['corpid', 'media_id'],
        'asyncuploadmedia'        => ['corpid', 'scene', 'type', 'filename', 'url', 'md5'],
    ];

    /**
     *
     * @return  array
     */
    public  function  messages()
    {
        return [
            'corpid.required'     => '授权方corpid不能为空',
            'file.required'       => '文件不能为空',
            'file.file'       => '文件格式不正确',
            'media_id.required'       => '素材id不能为空',
            'scene.required'       => '场景不能为空',
            'type.required'       => '素材类型不能为空',
            'filename.required'       => '文件名不能为空',
            'url.required'       => '素材url不能为空',
            'md5.required'       => '文件md5不能为空',
        ];
    }
}
