<?php

namespace Romanah\Gokbakja\Models;

use Model;

/**
 * Model
 */
class Employee extends Model
{
    use \October\Rain\Database\Traits\Validation;

    use \October\Rain\Database\Traits\SoftDelete;

    protected $dates = ['deleted_at'];

    public $belongsTo = [
        'job' => [
            'Romanah\Gokbakja\Models\Job',
            'key' => 'job_id'
        ]
    ];

    public $hasMany = [
        'machine' => [
            'Romanah\Gokbakja\Models\Machine',
            'key' => 'employee_id'
        ],
        'mechanic_machine' => [
            'Romanah\Gokbakja\Models\Machine',
            'key' => 'mechanic_id'
        ],
        'machine_production' => [
            'Romanah\Gokbakja\Models\ProductionMachine',
            'key' => 'employee_id'
        ],
        'machine_production_mechanic' => [
            'Romanah\Gokbakja\Models\ProductionMachine',
            'key' => 'mechanic_id'
        ],
    ];

    /**
     * @var string The database table used by the model.
     */
    public $table = 'romanah_gokbakja_employee';

    /**
     * @var array Validation rules
     */
    public $rules = [];
}
