<?php
namespace app\admin\validate\user;

use think\Validate;

class UserValidate extends Validate
{
    //定义规则
    protected $rule =   [
        'user_id'  => 'require|number',
        'status'   => 'require|in:0,1,2,3',
        'category' => 'require|in:实名认证,会员升级',
        'equipment_intelligence_id'  => 'require',
        'equipment_user_id'  => 'require',
        'equipment_type'  => 'require',
        'equipment_class'  => 'require',
        'equipment_status'  => 'require',
        'equipment_id'  => 'require',
        'relatives_id' => 'require',
        'user_real_name' => 'require',
        'user_card_id' => 'require',
        'user_certinfo' => 'require',
        'user_account' => 'require',
        'user_login_pwd' => 'require',
        'user_again_pwd' => 'require',
        'user_sex' => 'require',
        'user_birthday' => 'require',
        'user_status' => 'require',
        'user_is_owner' => 'require',
        'user_type' => 'require',
        'user_source' => 'require',

        'log_user_id' => 'require',
        'log_type' => 'require',
        'log_doctor_id' => 'require',
        'log_subject_id' => 'require',
        'log_id' => 'require',
        'data_user_id' => 'require',
    ];

    //定义描述
    protected $message  =   [
        'user_id.require' => '会员编号不能为空',
        'user_id.number'  => '会员编号为纯数字',
        'status.require'  => '审核状态不能为空',
        'status.in'       => '审核状态错误',
        'category.require' => '分类不能为空',
        'category.in'     => '分类类型错误',
        'equipment_intelligence_id.require' => '关联智能产品id不能为空',
        'equipment_user_id.require' => '会员编号不能为空',
        'equipment_type.require' => '智能设备类型不能为空',
        'equipment_class.require' => '设备分类不能为空',
        'equipment_status.require' => '智能设备状态不能为空',
        'relatives_id.require' => '亲属关系id不能为空',
        'equipment_id.require' => '智能设备id不能为空',
        'user_real_name.require' => '会员真实姓名不能为空',
        'user_card_id.require' => '会员身份证号不能为空',
        'user_certinfo.require' => '会员认证身份信息不能为空',
        'user_account.require' => '会员账号不能为空',
        'user_login_pwd.require' => '会员登录密码不能为空',
        'user_again_pwd.require' => '会员确认密码不能为空',
        'user_sex.require' => '会员性别不能为空',
        'user_birthday.require' => '会员生日不能为空',
        'user_status.require' => '会员状态不能为空',
        'user_is_owner.require' => '是否是业主不能为空',
        'user_type.require' => '会员身份不能为空',
        'user_source.require' => '会员来源不能为空',

        'log_user_id.require' => '会员id不能为空',
        'log_type.require' => '会员医嘱类型不能为空',
        'log_doctor_id.require' => '医生id不能为空',
        'log_subject_id.require' => '科目id不能为空',
        'log_id.require' => '医嘱id不能为空',
        'data_user_id.require' => '会员id不能为空',
    ];

    //定义场景
    protected $scene = [
        'info'  => ['user_id'],
        'create' => ['user_account','user_login_pwd','user_again_pwd','user_sex','user_birthday','user_status','user_is_owner','user_type','user_source'],
        'userAuth' => ['user_real_name','user_card_id','user_certinfo'],
        'auth'  => ['user_id', 'status', 'category'],
        'report' => ['user_id'],
        'relatives' => ['relatives_id'],
        'equipment' => ['equipment_intelligence_id','equipment_user_id','equipment_type','equipment_class','equipment_status'],
        'equipmentDel' => ['equipment_id'],
        'userDocter' => ['log_user_id', 'log_type', 'log_doctor_id', 'log_subject_id'],
        'DocterList' => ['log_user_id'],
        'DocterDel' => ['log_user_id', 'log_id'],
        'healthyDel' => ['data_user_id'],
    ];
}
