<?php

namespace modules\custom\models;

use Yii;
use modules\users\models\User;

/**
 * This is the model class For table "complaints".
 *
 * @property string $id
 * @property string $created_by
 * @property string $updated_by
 * @property string $deleted_by
 * @property string $actid
 * @property string $relatedid
 * @property string $employee
 * @property string $vehicle
 * @property integer $created_at
 * @property integer $updated_at
 * @property integer $deleted_at
 * @property integer $jobno
 * @property string $status
 * @property string $padno
 * @property string $comname
 * @property string $comphone
 * @property string $type
 * @property string $relatedto
 * @property string $overview
 * @property string $comaddress
 * @property integer $step1
 * @property integer $step2
 * @property integer $step3
 * @property integer $step4
 * @property integer $step5
 * @property integer $step6
 */
class Complaintsbe extends \common\models\Base
{
	public $dates = ['datereceived', 'step1date', 'step2date', 'step3date', 'step4date', 'step5date', 'step6date'];
	public $uniqueidentifiers = [];
   	public $securefields = [];
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'complaints';
    }

    /**
     * @inheritdoc
     */
    public function rules(): array
    {
        return [
            [['id', 'created_by', 'updated_by', 'deleted_by', 'actid', 'relatedid', 'employee', 'vehicle', 'status', 'padno', 'comname', 'comphone', 'type', 'relatedto', 'overview', 'comaddress'], 'string'],
            [['created_at', 'updated_at', 'deleted_at', 'jobno', ], 'integer'],
            [['step1', 'step2', 'step3', 'step4', 'step5', 'step6'],'boolean'],
            [['datereceived', 'step1date', 'step2date', 'step3date', 'step4date', 'step5date', 'step6date'], 'safe'],
            [['id'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels(): array
    {
        return [
            'id' => 'ID',
            'created_by' => 'Created By',
            'updated_by' => 'Updated By',
            'deleted_by' => 'Deleted By',
            'actid' => 'Actid',
            'relatedid' => 'Relatedid',
            'employee' => 'Employee',
            'vehicle' => 'Vehicle',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'deleted_at' => 'Deleted At',
            'jobno' => 'Jobno',
            'status' => 'Status',
            'padno' => 'Padno',
            'comname' => 'Comname',
            'comphone' => 'Comphone',
            'type' => 'Type',
            'relatedto' => 'Relatedto',
            'overview' => 'Overview',
            'comaddress' => 'Comaddress',
            'step1' => 'Step1',
            'step2' => 'Step2',
            'step3' => 'Step3',
            'step4' => 'Step4',
            'step5' => 'Step5',
            'step6' => 'Step6',
        ];
    }
    public function getFiles() {
		return $this->hasMany(\backend\models\Uploadsbe::class, ['relatedid' => 'id']);
	}
	public function getVehiclel() {
		return $this->hasOne(\modules\cors\models\Vehiclebe::class, ['id' => 'vehicle']);
	}
	public function getEmployeel() {
		return $this->hasOne(User::class, ['id' => 'employee']);
	}
	
}
