<?php
namespace app\finance\validate;

use think\Validate;

class VccPaymentValidate extends Validate
{
    protected $rule = [
        'payment_reason' => 'require|max:500',
        'amount'         => 'require|float|gt:0',
        'currency'       => 'require|max:8',
        'payment_method' => 'require',
        'payment_date'   => 'require|date',
    ];

    protected $message = [
        'payment_reason.require' => '付款事由不能为空',
        'amount.require'         => '金额不能为空',
        'amount.float'           => '金额必须为数字',
        'amount.gt'              => '金额必须大于0',
        'currency.require'       => '请选择金额单位（币种）',
        'payment_method.require' => '请选择付款方式',
        'payment_date.require'   => '请选择付款日期',
        'payment_date.date'      => '付款日期格式不正确',
    ];

    protected $scene = [
        'add'  => ['payment_reason', 'amount', 'currency', 'payment_method', 'payment_date'],
        'edit' => ['payment_reason', 'amount', 'currency', 'payment_method', 'payment_date'],
    ];
}
