<?php

namespace modules\forms\models;

use Yii;


/**
 * This is the model class For table "signature".
 *
 * @property string $id
 * @property string $language
 * @property string $created_by
 * @property string $updated_by
 * @property string $deleted_by
 * @property string $relatedid
 * @property string $centerid
 * @property string $actid
 * @property integer $jobno
 * @property integer $created_at
 * @property integer $updated_at
 * @property integer $created_by2
 * @property integer $updated_by2
 * @property integer $deleted_at
 * @property string $status
 * @property string $createdby_name
 * @property string $updatedby_name
 * @property string $deletedby_name
 * @property string $name
 * @property string $form
 * @property string $padno
 * @property boolean $deleted
 * @property string $datetime
 * @property string $signature
 * @property string $note
 */
class Signature extends \common\models\Base
{
    public $parentFields = ['created_at', 'created_by','createdby_name', 'updated_at', 'updated_by','updatedby_name', 'deleted_at', 'deleted_by','deletedby_name','language','relatedid', 'status', 'centerid', 'id'];
    public $dates = ['created_at', 'updated_at', 'deleted_at'];
    public $securefields = [];
    public $uniqueidentifiers = [];
    public $noshowview = [];
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'signature';
    }

    /**
     * @inheritdoc
     */
    public function rules(): array
    {
        $localRules =  [
            [['created_at', 'updated_at','deleted_at'], 'safe'],
            [['jobno', 'sequence'], 'integer'],
            [['deleted'], 'boolean'],
            [['datetime'], 'safe'],
            [['signature', 'note'], 'string'],
            [['id', 'created_by', 'updated_by', 'deleted_by', 'relatedid', 'centerid', 'actid'], 'string', 'max' => 36],
            [['language'], 'string', 'max' => 5],
            [['status', 'createdby_name', 'updatedby_name', 'deletedby_name', 'name', 'form', 'position'], 'string', 'max' => 255],
            [['padno'], 'string', 'max' => 15],
            ['id', 'default', 'value' => self::Tempid()],
            
            ['language', 'default', 'value' => 'en'],
        ];
        return array_merge($localRules, parent::Rules());
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels(): array
    {
        $localLabels = [
            'actid' => 'Activitiy ID',
            'jobno' => 'Job Number',
            'form' => 'Form',
            'padno' => 'Pad Number',
            'deleted' => 'Deleted',
            'datetime' => 'Datetime',
            'signature' => 'Signature',
            'position' => 'Position',
            'note' => 'Note',
    ];
        return array_merge($localLabels, parent::attributeLabels());
    }


    /**
     * Behaviors
     * Add Blameability and Timestamps to the record, unless the model is called by the Sync Controller.
     *
     * @return void
     */
    public function behaviors()    {
        if (Yii::$app->controller->id !== 'sync') {
            return parent::behaviors();
        } else {
            return parent::behaviors();
        }
    }

}
