<?php

declare(strict_types=1);

namespace App\DataFixtures;

use App\Entity\Contract;
use App\Enum\TrackingMode;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;

final class ContractFixtures extends Fixture
{
    public function load(ObjectManager $manager): void
    {
        $contract35 = new Contract()
            ->setName('35h')
            ->setTrackingMode(TrackingMode::TIME)
            ->setWeeklyHours(35)
            ->setIsActive(true)
        ;

        $contract4h = new Contract()
            ->setName('4h')
            ->setTrackingMode(TrackingMode::TIME)
            ->setWeeklyHours(4)
            ->setIsActive(true)
        ;

        $forfait = new Contract()
            ->setName('Forfait')
            ->setTrackingMode(TrackingMode::PRESENCE)
            ->setWeeklyHours(null)
            ->setIsActive(true)
        ;

        $interim = new Contract()
            ->setName('Interim')
            ->setTrackingMode(TrackingMode::TIME)
            ->setWeeklyHours(35)
            ->setIsActive(true)
        ;

        $manager->persist($contract35);
        $manager->persist($contract4h);
        $manager->persist($forfait);
        $manager->persist($interim);
        $manager->flush();

        $this->addReference(FixtureReferences::CONTRACT_35, $contract35);
        $this->addReference(FixtureReferences::CONTRACT_4H, $contract4h);
        $this->addReference(FixtureReferences::CONTRACT_FORFAIT, $forfait);
        $this->addReference(FixtureReferences::CONTRACT_INTERIM, $interim);
    }
}
