<?php

namespace App\Models\Tenancy;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;

class WorkingYear extends Model
{
    protected $table = 'working_year';

    public function scopeBetweenDates(Builder $query, Carbon $startDate, Carbon $endDate): void
    {
        $query->where('date', '>=', $startDate->toDateString())
            ->where('date', '<=', $endDate->toDateString());
    }

    public function scopeOfSpecialist(Builder $query, int $specialistId): void
    {
        $query->where('employer_id', $specialistId);
    }

    public function scopeForDate(Builder $query, Carbon $date)
    {
        $query->where('date', $date->toDateString());
    }
}
