<?php

declare(strict_types=1);

namespace App\Tests\Unit\Administration\Domain\Model\StudentGuardian;

use App\Administration\Domain\Model\StudentGuardian\RelationshipType;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

final class RelationshipTypeTest extends TestCase
{
    #[Test]
    #[DataProvider('labelProvider')]
    public function labelReturnsCorrectFrenchLabel(RelationshipType $type, string $expectedLabel): void
    {
        self::assertSame($expectedLabel, $type->label());
    }

    /**
     * @return iterable<string, array{RelationshipType, string}>
     */
    public static function labelProvider(): iterable
    {
        yield 'father' => [RelationshipType::FATHER, 'Père'];
        yield 'mother' => [RelationshipType::MOTHER, 'Mère'];
        yield 'tutor_m' => [RelationshipType::TUTOR_M, 'Tuteur'];
        yield 'tutor_f' => [RelationshipType::TUTOR_F, 'Tutrice'];
        yield 'grandparent_m' => [RelationshipType::GRANDPARENT_M, 'Grand-père'];
        yield 'grandparent_f' => [RelationshipType::GRANDPARENT_F, 'Grand-mère'];
        yield 'other' => [RelationshipType::OTHER, 'Autre'];
    }

    #[Test]
    public function allCasesHaveBackingValues(): void
    {
        foreach (RelationshipType::cases() as $case) {
            self::assertNotEmpty($case->value);
        }
    }

    #[Test]
    public function fromValueReturnsCorrectCase(): void
    {
        self::assertSame(RelationshipType::FATHER, RelationshipType::from('père'));
        self::assertSame(RelationshipType::MOTHER, RelationshipType::from('mère'));
    }
}
