<?php

namespace App\Models;

use App\Enums\Channel;
use App\Enums\ContentType;
use App\Enums\SocialMedia;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
use Swindon\FilamentHashids\Traits\HasHashid;

class ContentRecap extends Model implements HasMedia
{
    use HasFactory, HasHashid, InteractsWithMedia, SoftDeletes;

    protected $guarded = ['id'];

    protected function casts(): array
    {
        return [
            'type' => ContentType::class,
            'channel' => Channel::class,
            'social_media' => SocialMedia::class,
            'posting_date' => 'date',
            'classification_id' => 'integer',
        ];
    }

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