<?php

namespace backend\models;

use Yii;
use backend\models\TeamSkils;

/**
 * This is the model class for table "team".
 *
 * @property integer $id
 * @property integer $department_id
 * @property integer $user_id
 * @property string $name
 * @property string $name2
 * @property string $email
 * @property string $job
 * @property string $zodiac
 * @property integer $iq
 * @property string $soc_vk
 * @property string $soc_fb
 * @property string $soc_tw
 * @property string $soc_li
 * @property string $interests_caption
 * @property string $skils_caption
 * @property string $books_caption
 * @property string $films_caption
 * @property string $description
 * @property string $photo
 * @property string $photo_big
 * @property integer $visible
 *
 * @property Departments $department
 * @property TeamFilms[] $teamFilms
 * @property TeamHumors[] $teamHumors
 * @property TeamInterests[] $teamInterests
 * @property TeamSkils[] $teamSkils
 */
class Team extends \yii\db\ActiveRecord
{
	public $file;
	public $file2;

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

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['department_id', 'name', 'name2', 'job'], 'required'],
            [['department_id', 'user_id', 'iq', 'visible'], 'integer'],
            [['zodiac', 'interests_caption', 'skils_caption', 'books_caption', 'films_caption', 'description'], 'string'],
            [['name', 'name2', 'job'], 'string', 'max' => 150],
	        [['file', 'file2'], 'file'],
            [['email', 'soc_vk', 'soc_fb', 'soc_tw', 'soc_li'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'department_id' => Yii::t('app', 'Department ID'),
            'user_id' => Yii::t('app', 'User ID'),
            'name' => Yii::t('app', 'Name'),
            'name2' => Yii::t('app', 'Name2'),
            'email' => Yii::t('app', 'Email'),
            'job' => Yii::t('app', 'Job'),
            'zodiac' => Yii::t('app', 'Zodiac'),
            'iq' => Yii::t('app', 'Iq'),
            'soc_vk' => Yii::t('app', 'Soc Vk'),
            'soc_fb' => Yii::t('app', 'Soc Fb'),
            'soc_tw' => Yii::t('app', 'Soc Tw'),
            'soc_li' => Yii::t('app', 'Soc Li'),
            'interests_caption' => Yii::t('app', 'Interests Caption'),
            'skils_caption' => Yii::t('app', 'Skils Caption'),
            'books_caption' => Yii::t('app', 'Books Caption'),
            'films_caption' => Yii::t('app', 'Films Caption'),
            'description' => Yii::t('app', 'Description'),
            'file' => Yii::t('app', 'Photo'),
            'file2' => Yii::t('app', 'Photo Big'),
            'visible' => Yii::t('app', 'Visible'),
        ];
    }

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

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTeamFilms()
    {
        return $this->hasMany(TeamFilms::className(), ['team_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTeamHumors()
    {
        return $this->hasMany(TeamHumors::className(), ['team_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTeamInterests()
    {
        return $this->hasMany(TeamInterests::className(), ['team_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTeamSkils()
    {
        return $this->hasMany(TeamSkils::className(), ['team_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
//    public function getUser()
//    {
//        return $this->hasMany(UserSkils::className(), ['user_id' => 'id']);
//    }
}
