<?php
namespace app\finance\validate;

use think\Validate;

class PriceAdjustValidate extends Validate
{
    protected $rule = [
        'customer_id'        => 'require|max:100',
        'history_fee_deduct' => 'require|in:0,1',
        'trade_scene'        => 'require|in:1,2,3,4,5,6,7,8,9',
        'trade_scene_remark' => 'requireIf:trade_scene,9',
        'card_bin'           => 'require|in:1,2,3,4,5',
        'card_type'          => 'require|in:1,2',
        'fee_recharge'       => 'require',
        'fee_card_open'      => 'require',
        'fee_other'          => 'require',
        'monthly_trade_vol'  => 'require',
        'estimated_trade_vol'=> 'require',
        'competitor_info'    => 'require',
    ];

    protected $message = [
        'customer_id.require'         => '客户ID不能为空',
        'history_fee_deduct.require'  => '请选择历史费用是否需要补扣',
        'trade_scene.require'         => '请选择客户交易主要场景',
        'trade_scene_remark.requireIf'=> '选择【其他】场景时，交易场景备注不能为空',
        'card_bin.require'            => '请选择卡BIN',
        'card_type.require'           => '请选择卡类型',
        'fee_recharge.require'        => '调整的费项【充值】不能为空',
        'fee_card_open.require'       => '调整的费项【开卡】不能为空',
        'fee_other.require'           => '调整的其他费项不能为空',
        'monthly_trade_vol.require'   => '客户月均整体交易量不能为空',
        'estimated_trade_vol.require' => '预估切换交易量不能为空',
        'competitor_info.require'     => '友商名称和报价不能为空',
    ];

    protected $scene = [
        'add'  => ['customer_id', 'history_fee_deduct', 'trade_scene', 'trade_scene_remark', 'card_bin', 'card_type', 'fee_recharge', 'fee_card_open', 'fee_other', 'monthly_trade_vol', 'estimated_trade_vol', 'competitor_info'],
        'edit' => ['customer_id', 'history_fee_deduct', 'trade_scene', 'trade_scene_remark', 'card_bin', 'card_type', 'fee_recharge', 'fee_card_open', 'fee_other', 'monthly_trade_vol', 'estimated_trade_vol', 'competitor_info'],
    ];
}
