<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "evaluation".
 *
 * @property int $id
 * @property int $training_request_id
 * @property int $branch_user_id
 * @property string $attendance_and_moral_behavior
 * @property string $communication_skills
 * @property string $self_confidence
 * @property string $academic_knowledge
 * @property string $ability_to_absorb_tasks
 * @property string $speed_and_flexibility_in_completing_tasks
 * @property string $working_within_the_team
 * @property string $desire_to_learn
 * @property string $other_notes
 * @property string $strengths
 * @property string $weaknesses
 * @property string $evaluation
 *
 * @property TrainingRequests $trainingRequest
 * @property Users $branchUser
 */
class Evaluations extends \yii\db\ActiveRecord
{
    public $trainee_full_name;
    public $trainee_mother_name;
    public $serial_number;
    public $trainee_university_name;
    public $trainee_training_start_date;
    public $trainee_training_end_date;
    public $trainee_training_branch;
    public $trainee_mobile_phone;

    public $from_date;
    public $to_date;

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

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['training_request_id', 'branch_user_id', 'attendance_and_moral_behavior', 'communication_skills', 'self_confidence', 'academic_knowledge', 'ability_to_absorb_tasks', 'speed_and_flexibility_in_completing_tasks', 'working_within_the_team', 'desire_to_learn'], 'required'],
            [['training_request_id', 'branch_user_id', 'training_id'], 'integer'],
            [['attendance_and_moral_behavior', 'communication_skills', 'self_confidence', 'academic_knowledge', 'ability_to_absorb_tasks', 'speed_and_flexibility_in_completing_tasks', 'working_within_the_team', 'desire_to_learn', 'other_notes', 'strengths', 'weaknesses'], 'string'],
            [['training_request_id'], 'exist', 'skipOnError' => true, 'targetClass' => TrainingRequests::className(), 'targetAttribute' => ['training_request_id' => 'id']],
            [['branch_user_id'], 'exist', 'skipOnError' => true, 'targetClass' => Users::className(), 'targetAttribute' => ['branch_user_id' => 'id']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'training_request_id' => Yii::t('app', 'Training Request ID'),
            'branch_user_id' => Yii::t('app', 'Branch Admin'),
            'attendance_and_moral_behavior' => Yii::t('app', 'Attendance And Moral Behavior'),
            'communication_skills' => Yii::t('app', 'Communication Skills'),
            'self_confidence' => Yii::t('app', 'Self Confidence'),
            'academic_knowledge' => Yii::t('app', 'Academic Knowledge'),
            'ability_to_absorb_tasks' => Yii::t('app', 'Ability To Absorb Tasks'),
            'speed_and_flexibility_in_completing_tasks' => Yii::t('app', 'Speed And Flexibility In Completing Tasks'),
            'working_within_the_team' => Yii::t('app', 'Working Within The Team'),
            'desire_to_learn' => Yii::t('app', 'Desire To Learn'),
            'other_notes' => Yii::t('app', 'Other Notes'),
            'strengths' => Yii::t('app', 'Strengths'),
            'weaknesses' => Yii::t('app', 'Weaknesses'),
            'evaluation' => Yii::t('app', 'Evaluation'),
            'trainee_full_name' => Yii::t('app', 'Trainee Full Name'),
            'trainee_mother_name' => Yii::t('app', 'Trainee Mother Name'),
            'serial_number' => Yii::t('app', 'Serial Number'),
            'trainee_university_name' => Yii::t('app', 'University Name'),
            'trainee_training_start_date' => Yii::t('app', 'Start Date'),
            'trainee_training_end_date' => Yii::t('app', 'End Date'),
            'trainee_training_branch' => Yii::t('app', 'Branch'),
            'trainee_mobile_phone' => Yii::t('app', 'Mobile'),
            'from_date' => Yii::t('app', 'From Date'),
            'to_date' => Yii::t('app', 'To Date'),
        ];
    }

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

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

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