<?php

namespace App\Models;

use App\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;

class AttendanceCorrection extends Model
{
    use BelongsToTenant;

    protected $fillable = ['tenant_id', 'attendance_record_id', 'employee_id', 'original_check_in', 'original_check_out', 'requested_check_in', 'requested_check_out', 'requested_status', 'reason', 'status', 'requested_by', 'reviewed_by', 'reviewed_at', 'review_comment'];

    protected $casts = ['original_check_in' => 'datetime', 'original_check_out' => 'datetime', 'requested_check_in' => 'datetime', 'requested_check_out' => 'datetime', 'reviewed_at' => 'datetime'];

    public function attendanceRecord()
    {
        return $this->belongsTo(AttendanceRecord::class);
    }

    public function employee()
    {
        return $this->belongsTo(Employee::class);
    }

    public function requester()
    {
        return $this->belongsTo(User::class, 'requested_by');
    }

    public function reviewer()
    {
        return $this->belongsTo(User::class, 'reviewed_by');
    }
}
