<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "master_syarat".
 *
 * @property string $SKEMA_UUID
 * @property int $MASSYA_ID
 * @property string $MASSYA_UUID
 * @property string $MASSYA_SYARAT Bukti Syarat
 * @property string $MASSYA_ISI
 * @property string $CREATED
 * @property string $USERNAME
 */
class MasterSyarat extends \yii\db\ActiveRecord
{

    /**
     * ENUM field values
     */
    const MASSYA_SYARAT_BUKTI_PERSYARATAN_DASAR = 'Bukti Persyaratan Dasar';
    const MASSYA_SYARAT_BUKTI_ADMINISTRATIF = 'Bukti Administratif';

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

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['SKEMA_UUID', 'MASSYA_UUID', 'MASSYA_SYARAT', 'MASSYA_ISI', 'CREATED', 'USERNAME'], 'required'],
            [['SKEMA_UUID', 'MASSYA_UUID', 'MASSYA_SYARAT'], 'string'],
            [['CREATED'], 'safe'],
            [['MASSYA_ISI'], 'string', 'max' => 255],
            [['USERNAME'], 'string', 'max' => 50],
            ['MASSYA_SYARAT', 'in', 'range' => array_keys(self::optsMASSYASYARAT())],
            [['MASSYA_UUID'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'SKEMA_UUID' => 'Skema Uuid',
            'MASSYA_ID' => 'Massya ID',
            'MASSYA_UUID' => 'Massya Uuid',
            'MASSYA_SYARAT' => 'Bukti Syarat',
            'MASSYA_ISI' => 'Massya Isi',
            'CREATED' => 'Created',
            'USERNAME' => 'Username',
        ];
    }


    /**
     * column MASSYA_SYARAT ENUM value labels
     * @return string[]
     */
    public static function optsMASSYASYARAT()
    {
        return [
            self::MASSYA_SYARAT_BUKTI_PERSYARATAN_DASAR => 'Bukti Persyaratan Dasar',
            self::MASSYA_SYARAT_BUKTI_ADMINISTRATIF => 'Bukti Administratif',
        ];
    }

    /**
     * @return string
     */
    public function displayMASSYASYARAT()
    {
        return self::optsMASSYASYARAT()[$this->MASSYA_SYARAT];
    }

    /**
     * @return bool
     */
    public function isMASSYASYARATBuktiPersyaratanDasar()
    {
        return $this->MASSYA_SYARAT === self::MASSYA_SYARAT_BUKTI_PERSYARATAN_DASAR;
    }

    public function setMASSYASYARATToBuktiPersyaratanDasar()
    {
        $this->MASSYA_SYARAT = self::MASSYA_SYARAT_BUKTI_PERSYARATAN_DASAR;
    }

    /**
     * @return bool
     */
    public function isMASSYASYARATBuktiAdministratif()
    {
        return $this->MASSYA_SYARAT === self::MASSYA_SYARAT_BUKTI_ADMINISTRATIF;
    }

    public function setMASSYASYARATToBuktiAdministratif()
    {
        $this->MASSYA_SYARAT = self::MASSYA_SYARAT_BUKTI_ADMINISTRATIF;
    }
}
