<?php

namespace App\Http\Requests\Company\DynamicQrcode;

use App\Http\Requests\BaseRequest;

/**
 * 私信卡片接口验证
 * @author 唐远望
 * @version 1.0
 * @date 2025-08-25
 * 
 */
class MessageCard extends BaseRequest
{
    /**
     * 获取应用于请求的规则
     *
     * @return array
     */
    public function rules()
    {
        // 返回结果
        return      [
            'name'                 => 'required',
            'id'                => 'required|integer|gt:0',
            'status'            => 'required|integer|in:0,1',
            'page'              => 'integer|min:1',
            'limit'             => 'integer|min:1',
            'sort'              => 'required|integer|min:0',
            'template_id'       => 'required|integer|gt:0',
            'ids'               => 'required',
            'card_title'        => 'required',
            'card_description'  => 'required',
            'card_logo'         => 'required',
        ];
    }


    // 场景列表
    protected   $scenes         = [
        'add'               => ['template_id','card_title','card_description','card_logo'],
        'detail'             => ['id'],
        'list'               => ['page', 'limit'],
        'edit'                  => ['id','template_id','card_title','card_description','card_logo'],
        'set_status'              => ['id', 'status'],
        'delete'                  => ['id'],
        'batch_delete'            => ['ids'],
    ];

    /**
     * 获取已定义验证规则的错误消息
     *
     * @return array
     */
    public function messages()
    {
        return [
            'name.required'     => '名称必填',
            'id.required'       => 'ID未知',
            'id.integer'        => 'ID格式错误',
            'id.gt'               => 'ID格式错误',
            'status.required'   => '状态未知',
            'status.integer'    => '状态格式错误',
            'status.in'         => '状态格式错误',
            'page.integer'      => '页码格式错误',
            'page.min'          => '页码格式错误',
            'limit.integer'     => '每页数量格式错误',
            'limit.min'         => '每页数量格式错误',
            'sort.required'         => '排序未知',
            'sort.integer'          => '排序格式错误',
            'sort.min'              => '排序格式错误',
            'template_id.required'  => '模板ID未知',
            'template_id.integer'   => '模板ID格式错误',
            'template_id.gt'        => '模板ID格式错误',
            'ids.required'          => 'ID集合未知',
            'card_title.required'   => '卡片标题未知',
            'card_description.required'   => '卡片描述未知',
            'card_logo.required'    => '卡片logo未知',
        ];
    }
}
