<?php

declare(strict_types=1);

namespace App\Models;

use App\Enums\DisciplinarySeverity;
use App\Models\Concerns\LogsHrActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class DisciplinaryReport extends Model
{
    use HasFactory;
    use LogsHrActivity;
    use SoftDeletes;

    protected $fillable = [
        'employee_id',
        'report_date',
        'title',
        'description',
        'severity',
        'attachment_path',
        'created_by',
    ];

    protected function casts(): array
    {
        return [
            'report_date' => 'date',
            'severity' => DisciplinarySeverity::class,
        ];
    }

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

    public function creator(): BelongsTo
    {
        return $this->belongsTo(User::class, 'created_by');
    }
}
