<?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',
        'website_url'     => 'url|max:255',
        'business_type'   => 'require|max:128',
        'enterprise_size' => 'require|max:128',
        'address'         => 'require|max:255',
        'message'         => 'require',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
       'corp_name.require'       => '公司名称不能为空',
       'corp_name.max'           => '公司名称不能超过:rule个字符',
       'email.require'           => '邮箱不能为空',
       'email.email'             => '邮箱格式不正确',
       'email.max'               => '邮箱不能超过:rule个字符',
       'phone.require'           => '电话号码不能为空',
       'phone.max'               => '电话号码不能超过:rule个字符',
       'website_url.url'         => '网址格式不正确',
       'website_url.max'         => '网址不能超过:rule个字符',
       'business_type.require'   => '业务类型不能为空',
       'business_type.max'       => '业务类型不能超过:rule个字符',
       'enterprise_size.require' => '企业规模不能为空',
       'enterprise_size.max'     => '企业规模不能超过:rule个字符',
       'address.require'         => '公司地址不能为空',
       'address.max'             => '公司地址不能超过:rule个字符',
       'message.require'         => '留言不能为空',
    ];
}
