<?php
declare (strict_types = 1);

namespace app\index\validate;

use think\Validate;

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

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'corp_name.require'  => '公司名称不能为空',
        'corp_name.max'      => '公司名称不能超过:rule个字符',
        'url.url'            => '网址格式不正确',
        'url.max'            => '网址不能超过:rule个字符',
        'first_name.require' => '名不能为空',
        'first_name.max'     => '名不能超过:rule个字符',
        'last_name.require'  => '姓不能为空',
        'last_name.max'      => '姓不能超过:rule个字符',
        'email.require'      => '邮箱不能为空',
        'email.email'        => '邮箱格式不正确',
        'email.max'          => '邮箱不能超过:rule个字符',
        'phone.max'          => '电话号码不能超过:rule个字符',
        'interested.require' => '感兴趣的产品种类不能为空',
        'interested.max'     => '感兴趣的产品种类不能超过:rule个字符',
        'message.require'    => '留言内容不能为空',
        'message.max'        => '留言内容不能超过:rule个字符',
    ];
}
