<?php

namespace common\models;

use Yii;
use common\libs\logging\operate\valueType\Config as ValueTypeConfig;

/**
 * This is the model class for table "{{%RESEND_QY_AUDIT}}".
 *
 * @property string $ID
 * @property string $USER_ID 会员ID
 * @property string $RESEND_ID 补发表ID
 * @property string $SHOULD_BONUS 应发金额
 * @property string $RESEND_BONUS 补发金额
 * @property int $PERIOD_NUM 补发期数
 * @property int $AUDIT_STATUS 审核状态
 * @property string $RESEND_ADMIN_ID 补发管理员ID
 * @property string $AUDIT_ADMIN_ID 审核管理员ID
 * @property string $RESEND_REMARK 补发备注
 * @property string $AUDIT_REMARK 审核备注
 * @property int $CREATED_AT 创建时间
 * @property int $AUDITED_AT 审核时间
 */
class ResendQYAudit extends \common\components\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%RESEND_QY_AUDIT}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['USER_ID', 'RESEND_ID', 'PERIOD_NUM', 'RESEND_ADMIN_ID', 'CREATED_AT'], 'required'],
            [['SHOULD_BONUS', 'RESEND_BONUS'], 'number'],
            [['PERIOD_NUM', 'AUDIT_STATUS', 'CREATED_AT', 'AUDITED_AT'], 'integer'],
            [['ID', 'USER_ID', 'RESEND_ID', 'RESEND_ADMIN_ID', 'AUDIT_ADMIN_ID'], 'string', 'max' => 32],
            [['RESEND_REMARK', 'AUDIT_REMARK'], 'string', 'max' => 4000],
            [['ID'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'ID' => 'ID',
            'USER_ID' => '会员ID',
            'RESEND_ID' => '补发表ID',
            'SHOULD_BONUS' => '应发金额',
            'RESEND_BONUS' => '补发金额',
            'PERIOD_NUM' => '补发期数',
            'AUDIT_STATUS' => '审核状态',
            'RESEND_ADMIN_ID' => '补发管理员ID',
            'AUDIT_ADMIN_ID' => '审核管理员ID',
            'RESEND_REMARK' => '补发备注',
            'AUDIT_REMARK' => '审核备注',
            'CREATED_AT' => '创建时间',
            'AUDITED_AT' => '审核时间',
        ];
    }

    /**
     * 操作日志记录条件
     * @return array
     */
    public function attrLabelsWithLogType(){
        return [
            'USER_ID' => '会员ID',
            'SHOULD_BONUS' => '应发金额',
            'RESEND_BONUS' => '补发金额',
            'PERIOD_NUM' => '补发期数',
            'AUDIT_STATUS' => [
                'label' => '审核状态',
                'type' => ValueTypeConfig::AUDIT_STATUS_TYPE,
            ],
        ];
    }
}