<?php

declare(strict_types=1);

namespace App\Service\Contracts;

use App\Entity\Contract;
use App\Entity\Employee;
use App\Entity\EmployeeContractPeriod;
use App\Entity\InterimAgency;
use App\Enum\ContractNature;
use DateTimeImmutable;

final class EmployeeContractPeriodBuilder
{
    /**
     * @param null|array<int, int> $workDaysHours iso-day → minutes
     */
    public function build(
        Employee $employee,
        Contract $contract,
        DateTimeImmutable $startDate,
        ?DateTimeImmutable $endDate,
        ContractNature $nature,
        bool $isDriver = false,
        ?array $workDaysHours = null,
        ?InterimAgency $interimAgency = null,
    ): EmployeeContractPeriod {
        return new EmployeeContractPeriod()
            ->setEmployee($employee)
            ->setContract($contract)
            ->setStartDate($startDate)
            ->setEndDate($endDate)
            ->setContractNature($nature)
            ->setIsDriver($isDriver)
            ->setWorkDaysHours($workDaysHours)
            ->setInterimAgency($interimAgency)
        ;
    }
}
