<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%UPLOADS}}".
 *
 * @property string $ID
 * @property string $FILE_NAME 文件名称
 * @property string $CATEGORY 分类
 * @property string $REMARK 备注
 * @property string $URL 文件路径
 * @property string $FILE_SIZE 文件大小
 * @property string $MD5 MD5值
 * @property int $CREATED_AT 创建时间
 */
class Uploads extends \common\components\ActiveRecord
{
    const CATEGORY_ID_CARD = 'idCard';
    const CATEGORY_INVOICE = 'invoice';
    const CATEGORY_IMAGE = 'image';
    const CATEGORY_EXCEL = 'excel';
    const CATEGORY_UN_KNOW = 'unKnow';

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%UPLOADS}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['FILE_NAME', 'CATEGORY', 'URL', 'CREATED_AT'], 'required'],
            [['CREATED_AT'], 'integer'],
            [['ID', 'MD5'], 'string', 'max' => 32],
            [['FILE_NAME', 'CATEGORY', 'REMARK', 'FILE_SIZE'], 'string', 'max' => 255],
            [['URL'], 'string', 'max' => 1000],
            [['ID'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'ID' => 'ID',
            'FILE_NAME' => '文件名称',
            'CATEGORY' => '分类',
            'REMARK' => '备注',
            'URL' => '文件路径',
            'FILE_SIZE' => '文件大小',
            'MD5' => 'MD5值',
            'CREATED_AT' => '创建时间',
        ];
    }
}
