<?php

namespace App\Models;

use App\Enums\BlockedPeriodEnum;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * @property int $id
 * @property int $provider_id
 * @property \Illuminate\Support\Carbon $date
 * @property BlockedPeriodEnum $period
 * @property string|null $reason
 * @property string $init_hour
 * @property string $end_hour
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property-read \App\Models\Provider $provider
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay query()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay whereDate($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay whereEndHour($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay whereInitHour($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay wherePeriod($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay whereProviderId($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay whereReason($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay withTrashed(bool $withTrashed = true)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderBlockedDay withoutTrashed()
 * @mixin \Eloquent
 */
class ProviderBlockedDay extends Model
{
    use HasFactory, SoftDeletes;

    protected $fillable = [
        'provider_id',
        'date',
        'period',
        'reason',
        'init_hour',
        'end_hour',
    ];

    protected $casts = [
        'date'   => 'date',
        'period' => BlockedPeriodEnum::class,
    ];

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