<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%USER_TOKEN}}".
 *
 * @property string $ID
 * @property string $USER_ID 会员ID
 * @property string $PC_ACCESS_TOKEN PC端TOKEN
 * @property string $APP_ACCESS_TOKEN APP端TOKEN
 * @property string $PC_REFRESH_TOKEN PC刷新TOKEN
 * @property string $APP_REFRESH_TOKEN APP刷新TOKEN
 * @property int $CREATED_AT 创建时间
 * @property int $PAT_UPDATED_AT PC端TOKEN更新时间
 * @property int $AAT_UPDATED_AT APP端TOKEN更新时间
 * @property int $PRT_UPDATED_AT PC刷新TOKEN更新时间
 * @property int $ART_UPDATED_AT APP刷新TOKEN更新时间
 */
class UserToken extends \common\components\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%USER_TOKEN}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['USER_ID', 'CREATED_AT'], 'required'],
            [['CREATED_AT', 'PAT_UPDATED_AT', 'AAT_UPDATED_AT', 'PRT_UPDATED_AT', 'ART_UPDATED_AT'], 'integer'],
            [['ID', 'USER_ID'], 'string', 'max' => 32],
            [['PC_ACCESS_TOKEN', 'APP_ACCESS_TOKEN', 'PC_REFRESH_TOKEN', 'APP_REFRESH_TOKEN'], 'string', 'max' => 255],
            [['APP_ACCESS_TOKEN'], 'unique'],
            [['APP_REFRESH_TOKEN'], 'unique'],
            [['PC_ACCESS_TOKEN'], 'unique'],
            [['PC_REFRESH_TOKEN'], 'unique'],
            [['ID'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'ID' => 'ID',
            'USER_ID' => '会员ID',
            'PC_ACCESS_TOKEN' => 'PC端TOKEN',
            'APP_ACCESS_TOKEN' => 'APP端TOKEN',
            'PC_REFRESH_TOKEN' => 'PC刷新TOKEN',
            'APP_REFRESH_TOKEN' => 'APP刷新TOKEN',
            'CREATED_AT' => '创建时间',
            'PAT_UPDATED_AT' => 'PC端TOKEN更新时间',
            'AAT_UPDATED_AT' => 'APP端TOKEN更新时间',
            'PRT_UPDATED_AT' => 'PC刷新TOKEN更新时间',
            'ART_UPDATED_AT' => 'APP刷新TOKEN更新时间',
        ];
    }
}
