<?php

namespace common\modules\support\models\redmine;

use Yii;

class Issue extends yii\base\Model
{
    public $subject;
    public $project_id;
    public $priority_id = self::PRIORITY_FIRE;
    public $description;
    public $author_id;
    public $tracker_id = self::TRACKER_NONE;
    public $status_id = self::STATUS_NEW;

    public $files = null;

    const PRIORITY_SIMPLE = 2;
    const PRIORITY_FIRE = 3;

    const TRACKER_NONE = 14; // Не определено

    const STATUS_NEW = 7;

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['tracker_id', 'status_id', 'priority_id'], 'required'],

            [['project_id'], 'required', 'message' => 'Выберите проект, к которому относится новая задача'],
            [['subject'], 'required', 'message' => 'Введите наименование задачи'],
            [['description'], 'required', 'message' => 'Укажите описание задачи'],

            [['tracker_id', 'project_id', 'status_id', 'priority_id'], 'integer'],
            [['description'], 'string'],
            [['files'], 'safe'],
            [['subject'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'project_id' => 'Проект',
            'subject' => 'Заголовок задачи',
            'tracker_id' => 'Tracker ID',
            'description' => 'Текст задачи',
            'priority_id' => 'Важность',
            'status_id' => 'Статус',
        ];
    }

   
}