<?php
declare (strict_types = 1);

namespace app\index\validate;

use think\Validate;

class ProductInquiryValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'first_name'   => 'require|max:64',
        'last_name'    => 'require|max:64',
        'email'        => 'require|email|max:128',
        'phone'        => 'require|max:64',
        'country_name' => 'require|max:128',
        'corp_name'    => 'require|max:128',
        'industry'     => 'require|max:64',
        'message'      => 'require|max:1024',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'first_name.require'   => '名不能为空',
        'first_name.max'       => '名不能超过:rule个字符',
        'last_name.require'    => '姓不能为空',
        'last_name.max'        => '姓不能超过:rule个字符',
        'email.require'        => '邮箱不能为空',
        'email.email'          => '邮箱格式不正确',
        'email.max'            => '邮箱不能超过:rule个字符',
        'phone.max'            => '电话号码不能超过:rule个字符',
        'country_name.require' => '国家不能为空',
        'country_name.max'     => '国家不能超过:rule个字符',
        'corp_name.require'    => '公司/组织不能为空',
        'corp_name.max'        => '公司/组织不能超过:rule个字符',
        'industry.require'     => '行业不能为空',
        'industry.max'         => '行业不能超过:rule个字符',
        'message.require'      => '询问内容不能为空',
        'message.max'          => '询问内容不能超过:rule个字符'
    ];
}
