<?php

namespace Tests\Unit;

use App\Models\MariachiGroup;
use PHPUnit\Framework\TestCase;

class MariachiGroupTest extends TestCase
{
    public function test_it_builds_a_serenata_prefix_from_the_group_code(): void
    {
        $group = new MariachiGroup([
            'code' => 'mariachi_azteca_bogota',
            'name' => 'Mariachi Azteca Bogota',
        ]);

        $this->assertSame('MAB', $group->serenataCodePrefix());
    }

    public function test_it_keeps_numeric_suffixes_for_duplicate_group_codes(): void
    {
        $group = new MariachiGroup([
            'code' => 'mariachi_azteca_2',
            'name' => 'Mariachi Azteca',
        ]);

        $this->assertSame('MA2', $group->serenataCodePrefix());
    }

    public function test_it_prioritizes_the_group_name_over_a_generic_internal_code(): void
    {
        $group = new MariachiGroup([
            'code' => 'grupo_1',
            'name' => 'Mariachi Azteca Bogota',
        ]);

        $this->assertSame('MAB', $group->serenataCodePrefix());
    }
}
