<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class CharacteristicApproverMaster extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'plant_id',
        'machine_id',
        'machine_name',
        'characteristic_field',
        'approver_type',
        'name1',
        'mail1',
        'name2',
        'mail2',
        'name3',
        'mail3',
        'duration1',
        'duration2',
        'duration3',
        'created_at',
        'updated_at',
        'created_by',
        'updated_by',
    ];

    public function plant(): BelongsTo
    {
        return $this->belongsTo(Plant::class);
    }

    public function machine(): BelongsTo
    {
        return $this->belongsTo(Machine::class);
    }

    public function requestCharacteristics()
    {
        return $this->hasMany(RequestCharacteristic::class, 'characteristic_approver_master_id');
    }
}
