<?php

namespace App\Factory;

use App\Entity\TaskNote;
use App\Enum\TaskNoteContactType;
use App\Repository\TaskNoteRepository;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;

/**
 * @extends ModelFactory<TaskNote>
 *
 * @method        TaskNote|Proxy                     create(array|callable $attributes = [])
 * @method static TaskNote|Proxy                     createOne(array $attributes = [])
 * @method static TaskNote|Proxy                     find(object|array|mixed $criteria)
 * @method static TaskNote|Proxy                     findOrCreate(array $attributes)
 * @method static TaskNote|Proxy                     first(string $sortedField = 'id')
 * @method static TaskNote|Proxy                     last(string $sortedField = 'id')
 * @method static TaskNote|Proxy                     random(array $attributes = [])
 * @method static TaskNote|Proxy                     randomOrCreate(array $attributes = [])
 * @method static TaskNoteRepository|RepositoryProxy repository()
 * @method static TaskNote[]|Proxy[]                 all()
 * @method static TaskNote[]|Proxy[]                 createMany(int $number, array|callable $attributes = [])
 * @method static TaskNote[]|Proxy[]                 createSequence(iterable|callable $sequence)
 * @method static TaskNote[]|Proxy[]                 findBy(array $attributes)
 * @method static TaskNote[]|Proxy[]                 randomRange(int $min, int $max, array $attributes = [])
 * @method static TaskNote[]|Proxy[]                 randomSet(int $number, array $attributes = [])
 */
final class TaskNoteFactory extends ModelFactory
{
    /**
     * @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
     *
     * @todo inject services if required
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
     *
     * @todo add your default values here
     */
    protected function getDefaults(): array
    {
        return [
            'createdAt' => \DateTimeImmutable::createFromMutable(self::faker()->dateTime()),
            'message' => self::faker()->text(),
            'owner' => UserFactory::random(),
            'task' => TaskFactory::random(),
            'type' => self::faker()->randomElement(TaskNoteContactType::cases()),
            'contact' => ContactFactory::random()
        ];
    }

    /**
     * @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
     */
    protected function initialize(): self
    {
        return $this
            // ->afterInstantiate(function(TaskNote $taskNote): void {})
        ;
    }

    protected static function getClass(): string
    {
        return TaskNote::class;
    }
}
