<?php

declare(strict_types=1);

/*
 * This file is part of the Ferienpass package.
 *
 * (c) Richard Henkenjohann <richard@ferienpass.online>
 *
 * For more information visit the project website <https://ferienpass.online>
 * or the documentation under <https://docs.ferienpass.online>.
 */

namespace Ferienpass\CoreBundle\Fixtures\Factory;

use Ferienpass\CoreBundle\Entity\Attendance;
use Ferienpass\CoreBundle\Entity\Participant\BaseParticipant;
use Zenstruck\Foundry\Object\Instantiator;
use Zenstruck\Foundry\ObjectFactory;

class AttendanceFactory extends ObjectFactory
{
    public function withOffer($offer): static
    {
        return $this->with(['offer' => $offer]);
    }

    public function withStatus(string $status): static
    {
        return $this->with(['status' => $status]);
    }

    public function withParticipant(BaseParticipant $participant): static
    {
        return $this->with(['participant' => $participant]);
    }

    public static function class(): string
    {
        return Attendance::class;
    }

    protected function defaults(): array
    {
        return [
            'offer' => OfferFactory::new(),
            'participant' => ParticipantFactory::new(),
        ];
    }

    protected function initialize(): static
    {
        return $this->instantiateWith(Instantiator::withoutConstructor()->alwaysForce('offer', 'participant', 'status'));
    }
}
