<?php

namespace App\Models;

use App\Enums\WorkingPeriodEnum;
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 int $day
 * @property WorkingPeriodEnum $period
 * @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>|ProviderWorkingDay newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderWorkingDay newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderWorkingDay onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderWorkingDay query()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderWorkingDay whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderWorkingDay whereDay($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderWorkingDay whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderWorkingDay whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderWorkingDay wherePeriod($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderWorkingDay whereProviderId($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderWorkingDay whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderWorkingDay withTrashed(bool $withTrashed = true)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|ProviderWorkingDay withoutTrashed()
 * @mixin \Eloquent
 */
class ProviderWorkingDay extends Model
{
    use HasFactory, SoftDeletes;

    protected $fillable = [
        'provider_id',
        'day',
        'period',
    ];

    protected $casts = [
        'day'    => 'integer',
        'period' => WorkingPeriodEnum::class,
    ];

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