<?php

namespace App\Models;

use App\Enums\IssueSentiment;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Swindon\FilamentHashids\Traits\HasHashid;

class IssueManagement extends Model
{
    use HasFactory, HasHashid, SoftDeletes;

    protected $guarded = ['id'];

    protected function casts(): array
    {
        return [
            'issue' => IssueSentiment::class,
            'response' => IssueSentiment::class,
            'location_id' => 'integer',
            'sub_location_id' => 'integer',
            'classification_id' => 'integer',
            'sub_classification_id' => 'integer',
            'media_monitoring_id' => 'integer',
        ];
    }

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

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

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

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

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