<?php
declare (strict_types = 1);

namespace app\index\validate;

use think\Validate;

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

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
       'corp_name.require'       => 'contact_distributor.validate_name_required',
       'corp_name.max'           => 'contact_distributor.validate_name_max',
       'email.require'           => 'contact_distributor.validate_email_required',
       'email.email'             => 'contact_distributor.validate_email_email',
       'email.max'               => 'contact_distributor.validate_email_max',
       'phone.require'           => 'contact_distributor.validate_phone_required',
       'phone.max'               => 'contact_distributor.validate_phone_max',
       'business_type.require'   => 'contact_distributor.validate_business_type_required',
       'business_type.max'       => 'contact_distributor.validate_business_type_max',
       'enterprise_size.require' => 'contact_distributor.validate_enterprise_size_required',
       'enterprise_size.max'     => 'contact_distributor.validate_enterprise_size_max',
       'address.require'         => 'contact_distributor.validate_address_required',
       'address.max'             => 'contact_distributor.validate_address_max',
       'message.require'         => 'contact_distributor.validate_message_required',
    ];
}
