<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * @property int         $id
 * @property int         $user_id
 * @property string      $era_type
 * @property string      $title
 * @property string|null $description
 * @property \Carbon\Carbon $starts_at
 * @property \Carbon\Carbon|null $ends_at
 * @property bool        $is_current
 * @property array|null  $metadata
 */
final class CreatorEra extends Model
{
    protected $fillable = [
        'user_id',
        'era_type',
        'title',
        'description',
        'starts_at',
        'ends_at',
        'is_current',
        'metadata',
    ];

    protected $casts = [
        'starts_at'  => 'datetime',
        'ends_at'    => 'datetime',
        'is_current' => 'boolean',
        'metadata'   => 'array',
    ];

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