<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "fix_car_item_t".
 *
 * @property integer $id
 * @property integer $report_id
 * @property integer $fix_id
 * @property integer $fk_id
 * @property integer $count
 * @property integer $pay_type
 * @property integer $type
 * @property integer $fix_user
 * @property string $fix_remark
 * @property integer $status
 * @property string $insurance_price
 * @property string $created_at
 * @property string $updated_at
 *
 * @property FixCarT $fix
 * @property FixCarReport $report
 */
class FixCarItemT extends \common\models\Base
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'fix_car_item_t';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['report_id', 'fix_id', 'fk_id', 'count', 'pay_type', 'type', 'fix_user', 'status','mark_wait_list','fix_group','lock_id','fix_status','metal_plate_install','is_get'], 'integer'],
            [['insurance_price','price'], 'number'],
            [['created_at', 'updated_at','get_time','confirm_at'], 'safe'],
            [['fix_remark'], 'string', 'max' => 255],
            [['fix_id'], 'exist', 'skipOnError' => true, 'targetClass' => FixCarT::className(), 'targetAttribute' => ['fix_id' => 'id']],
            [['report_id'], 'exist', 'skipOnError' => true, 'targetClass' => FixCarReport::className(), 'targetAttribute' => ['report_id' => 'id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'report_id' => '备案号',
            'fix_id' => 'Fix ID',
            'fk_id' => 'Fk ID',
            'lock_id'=>'Lock ID',
            'count' => 'Count',
            'pay_type' => 'Pay Type',
            'type' => 'Type',
            'fix_user' => 'Fix User',
            'fix_remark' => 'Fix Remark',
            'mark_wait_list'=>'Mark Wait List',
            'status' => 'Status',
            'fix_status'=>'Fix Status',
            'insurance_price' => 'Insurance Price',
            'fix_group'=>'Fix Group',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'get_time'=>'Get Time',
            'confirm_at'=>'Confirm At',
            'metal_plate_install'=>'Metal Plate Install',
            'price'=>'Price',
            'is_get'=>'Is Get'
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getFix()
    {
        return $this->hasOne(FixCarT::className(), ['id' => 'fix_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getReport()
    {
        return $this->hasOne(FixCarReport::className(), ['id' => 'report_id']);
    }
    public function getGroup(){
        return $this->hasOne(FixCarGroup::className(),['id'=>'fix_group']);
    }
    public function getUser(){
        return $this->hasOne(UserT::className(),['id'=>'fix_user']);
    }
}
