<?php

namespace modules\custom\models;

use Yii;
use yii\behaviors\BlameableBehavior;
use yii\behaviors\TimestampBehavior;
use modules\users\models\User;
/**
 * This is the model class For table "dt078".
 *
 * @property string $id
 * @property string $created_by
 * @property string $updated_by
 * @property string $deleted_by
 * @property string $actid
 * @property string $relatedid
 * @property string $name
 * @property string $signednameop
 * @property string $signednamesup
 * @property int $created_at
 * @property int $updated_at
 * @property int $deleted_at
 * @property int $jobno
 * @property int $date
 * @property string $status
 * @property string $padno
 * @property string $natindno
 * @property string $reason
 * @property string $medication
 * @property string $advice
 * @property string $opsigned
 * @property string $supsigned
 * @property int $selfpescribed
 * @property int $pescribed
 * @property int $maywork
 * @property int $accompanied
 * @property int $safety
 * @property int $stooddown
 */
class Dt078be extends \common\models\Base {
	
    public $dates = ['created_at', 'updated_at', 'deleted_at', 'date', 'startdate', 'finishdate'];
	public $uniqueidentifiers = ['actid', 'relatedid', 'name', 'signednameop', 'signednamesup'];
   	public $securefields = ['natindno'];
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'dt078';
    }

    /**
     * {@inheritdoc}
     */
    public function rules(): array
    {
        return [
            [['id', 'created_by', 'updated_by', 'deleted_by', 'actid', 'relatedid', 'name', 'signednameop', 'signednamesup', 'status', 'padno', 'natindno', 'reason', 'medication', 'advice', 'opsigned', 'supsigned','maywork', 'accompanied', 'safety', 'stooddown'], 'string'],
            [[ 'jobno', 'selfpescribed', 'pescribed','duration'], 'integer'],
        	[['created_at', 'updated_at', 'deleted_at',], 'safe'],
            [['id'], 'unique'],
            [['date', 'startdate', 'finishdate'], 'safe'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels(): array
    {
        return [
            'id' => 'ID',
            'created_by' => 'Created By',
            'updated_by' => 'Updated By',
            'deleted_by' => 'Deleted By',
            'actid' => 'Actid',
            'relatedid' => 'Relatedid',
            'name' => 'Name',
            'signednameop' => 'Signednameop',
            'signednamesup' => 'Signednamesup',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'deleted_at' => 'Deleted At',
            'jobno' => 'Jobno',
            'date' => 'Date',
            'status' => 'Status',
            'padno' => 'Padno',
            'natindno' => 'Natindno',
            'reason' => 'Reason',
            'medication' => 'Medication',
            'advice' => 'Advice',
            'opsigned' => 'Opsigned',
            'supsigned' => 'Supsigned',
            'selfpescribed' => 'Selfpescribed',
            'pescribed' => 'Pescribed',
            'maywork' => 'Maywork',
            'accompanied' => 'Accompanied',
            'safety' => 'Safety',
            'stooddown' => 'Stooddown',
        ];
    }
    public function getEmployeen() {
		return $this->hasOne(User::class, ['id' => 'name']);
	}    public function getOp() {
		return $this->hasOne(User::class, ['id' => 'signednameop']);
	}    public function getSup() {
		return $this->hasOne(User::class, ['id' => 'signednamesup']);
	}
	
}
