<?php

use App\Enums\MediaType;

describe('MediaType Enum', function () {
    it('has correct cases', function () {
        $cases = MediaType::cases();

        expect($cases)->toHaveCount(4)
            ->and(collect($cases)->pluck('value')->toArray())
            ->toEqual([1, 2, 3, 4]);
    });

    it('can get value from case', function () {
        expect(MediaType::ONLINE->value)->toBe(1)
            ->and(MediaType::PRINT->value)->toBe(2)
            ->and(MediaType::RADIO->value)->toBe(3)
            ->and(MediaType::TELEVISION->value)->toBe(4);
    });

    it('can get label from case', function () {
        expect(MediaType::ONLINE->getLabel())->toBe('Online')
            ->and(MediaType::PRINT->getLabel())->toBe('Cetak')
            ->and(MediaType::RADIO->getLabel())->toBe('Radio')
            ->and(MediaType::TELEVISION->getLabel())->toBe('Televisi');
    });

    it('can get options array', function () {
        $options = MediaType::options();

        expect($options)->toBeArray()
            ->and($options)->toHaveKey(1, 'Online')
            ->and($options)->toHaveKey(2, 'Cetak')
            ->and($options)->toHaveKey(3, 'Radio')
            ->and($options)->toHaveKey(4, 'Televisi');
    });
});
