<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;
use OwenIt\Auditing\Auditable as AuditableTrait;

class EmployeeApprovers extends Model implements Auditable
{
    use HasFactory, SoftDeletes, AuditableTrait;

     /**
     * The attributes that are NOT mass assignable.
     *
     */
    protected $guarded = [
        'deleted_at',
    ];

    /**
     * The attributes that should be cast.
     *
     * @var array<string, string>
     */
    protected $casts = [
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
        'deleted_at' => 'datetime',
    ];

    protected $hidden = [
        'created_at',
        'updated_at',
        'deleted_at',
    ];

    public function employee(): BelongsTo
    {
        return $this->belongsTo(Employee::class, 'signatory_id', 'employee_id');
    }

    public function employee_undertime(): BelongsTo
    {
        return $this->belongsTo(EmployeeUndertime::class, 'attendance_id');
    }

    public function employee_profile(): BelongsTo
    {
        return $this->belongsTo(EmployeeProfilePicture::class, 'employee_id', 'employee_id');
    }

    public function employee_profile_approver(): BelongsTo
    {
        return $this->belongsTo(EmployeeProfilePicture::class, 'signatory_id', 'employee_id');
    }
}
