<?php

declare(strict_types=1);

namespace app\common\validate;

use think\Validate;

class AgentCommissionRecord extends Validate
{
    protected $failException = true;

    protected $rule = [
        'settlement_period_id' => 'require|integer|gt:0',
        'channel_id' => 'require|integer|gt:0',
        'admin_id' => 'require|integer|gt:0',
        'commission_rate' => 'require|float|egt:0',
        'calc_base_amount' => 'require|float',
        'commission_amount' => 'require|float',
        'status' => 'in:0,1,2',
        'remark' => 'max:255',
    ];

    protected $scene = [
        'add' => ['settlement_period_id', 'channel_id', 'admin_id', 'commission_rate', 'calc_base_amount', 'commission_amount', 'status', 'remark'],
        'edit' => ['commission_rate', 'calc_base_amount', 'commission_amount', 'status', 'remark'],
    ];
}
