<?php

declare(strict_types=1);

use App\Framework\UserAgent\ValueObjects\DeviceCategory;

describe('DeviceCategory Value Object', function () {
    it('has all expected device categories', function () {
        expect(DeviceCategory::BOT)->toBeInstanceOf(DeviceCategory::class);
        expect(DeviceCategory::MOBILE)->toBeInstanceOf(DeviceCategory::class);
        expect(DeviceCategory::DESKTOP)->toBeInstanceOf(DeviceCategory::class);
        expect(DeviceCategory::TABLET)->toBeInstanceOf(DeviceCategory::class);
        expect(DeviceCategory::UNKNOWN)->toBeInstanceOf(DeviceCategory::class);
    });

    it('returns correct display names', function () {
        expect(DeviceCategory::BOT->getDisplayName())->toBe('Bot');
        expect(DeviceCategory::MOBILE->getDisplayName())->toBe('Mobile Device');
        expect(DeviceCategory::DESKTOP->getDisplayName())->toBe('Desktop Computer');
        expect(DeviceCategory::TABLET->getDisplayName())->toBe('Tablet');
        expect(DeviceCategory::UNKNOWN->getDisplayName())->toBe('Unknown Device');
    });

    it('correctly identifies mobile devices', function () {
        expect(DeviceCategory::MOBILE->isMobile())->toBeTrue();
        expect(DeviceCategory::TABLET->isMobile())->toBeTrue();
        expect(DeviceCategory::DESKTOP->isMobile())->toBeFalse();
        expect(DeviceCategory::BOT->isMobile())->toBeFalse();
        expect(DeviceCategory::UNKNOWN->isMobile())->toBeFalse();
    });

    it('correctly identifies desktop devices', function () {
        expect(DeviceCategory::DESKTOP->isDesktop())->toBeTrue();
        expect(DeviceCategory::MOBILE->isDesktop())->toBeFalse();
        expect(DeviceCategory::TABLET->isDesktop())->toBeFalse();
        expect(DeviceCategory::BOT->isDesktop())->toBeFalse();
        expect(DeviceCategory::UNKNOWN->isDesktop())->toBeFalse();
    });

    it('correctly identifies bots', function () {
        expect(DeviceCategory::BOT->isBot())->toBeTrue();
        expect(DeviceCategory::MOBILE->isBot())->toBeFalse();
        expect(DeviceCategory::DESKTOP->isBot())->toBeFalse();
        expect(DeviceCategory::TABLET->isBot())->toBeFalse();
        expect(DeviceCategory::UNKNOWN->isBot())->toBeFalse();
    });

    it('has correct enum values', function () {
        expect(DeviceCategory::BOT->value)->toBe('bot');
        expect(DeviceCategory::MOBILE->value)->toBe('mobile');
        expect(DeviceCategory::DESKTOP->value)->toBe('desktop');
        expect(DeviceCategory::TABLET->value)->toBe('tablet');
        expect(DeviceCategory::UNKNOWN->value)->toBe('unknown');
    });
});
