<?php

declare(strict_types=1);

use App\Framework\Router\AdminRoutes;
use App\Framework\Router\ApiRoutes;
use App\Framework\Router\HealthRoutes;
use App\Framework\Router\MediaRoutes;
use App\Framework\Router\RouteCategory;
use App\Framework\Router\WebRoutes;

describe('Route Enums', function () {

    describe('WebRoutes', function () {
        it('implements RouteNameInterface correctly', function () {
            expect(WebRoutes::HOME)->toBeInstanceOf(\App\Framework\Router\RouteNameInterface::class);
        });

        it('returns correct values', function () {
            expect(WebRoutes::HOME->value)->toBe('home');
            expect(WebRoutes::CONTACT->value)->toBe('contact');
        });

        it('returns correct category', function () {
            expect(WebRoutes::HOME->getCategory())->toBe(RouteCategory::WEB);
        });

        it('returns correct route type checks', function () {
            expect(WebRoutes::HOME->isWebRoute())->toBeTrue();
            expect(WebRoutes::HOME->isApiRoute())->toBeFalse();
            expect(WebRoutes::HOME->isAdminRoute())->toBeFalse();
            expect(WebRoutes::HOME->isAuthRoute())->toBeFalse();
        });
    });

    describe('ApiRoutes', function () {
        it('implements RouteNameInterface correctly', function () {
            expect(ApiRoutes::USERS_LIST)->toBeInstanceOf(\App\Framework\Router\RouteNameInterface::class);
        });

        it('returns correct values', function () {
            expect(ApiRoutes::USERS_LIST->value)->toBe('api_users_list');
            expect(ApiRoutes::HEALTH->value)->toBe('api_health');
        });

        it('returns correct category', function () {
            expect(ApiRoutes::USERS_LIST->getCategory())->toBe(RouteCategory::API);
        });

        it('returns correct route type checks', function () {
            expect(ApiRoutes::USERS_LIST->isApiRoute())->toBeTrue();
            expect(ApiRoutes::USERS_LIST->isWebRoute())->toBeFalse();
            expect(ApiRoutes::USERS_LIST->isAdminRoute())->toBeFalse();
            expect(ApiRoutes::USERS_LIST->isAuthRoute())->toBeFalse();
        });
    });

    describe('AdminRoutes', function () {
        it('implements RouteNameInterface correctly', function () {
            expect(AdminRoutes::DASHBOARD)->toBeInstanceOf(\App\Framework\Router\RouteNameInterface::class);
        });

        it('returns correct values', function () {
            expect(AdminRoutes::DASHBOARD->value)->toBe('admin.dashboard');
            expect(AdminRoutes::MIGRATIONS->value)->toBe('admin.migrations');
        });

        it('returns correct category', function () {
            expect(AdminRoutes::DASHBOARD->getCategory())->toBe(RouteCategory::ADMIN);
        });

        it('returns correct route type checks', function () {
            expect(AdminRoutes::DASHBOARD->isAdminRoute())->toBeTrue();
            expect(AdminRoutes::DASHBOARD->isApiRoute())->toBeFalse();
            expect(AdminRoutes::DASHBOARD->isWebRoute())->toBeFalse();
            expect(AdminRoutes::DASHBOARD->isAuthRoute())->toBeFalse();
        });
    });

    describe('HealthRoutes', function () {
        it('implements RouteNameInterface correctly', function () {
            expect(HealthRoutes::HEALTH_CHECK)->toBeInstanceOf(\App\Framework\Router\RouteNameInterface::class);
        });

        it('returns correct values', function () {
            expect(HealthRoutes::HEALTH_CHECK->value)->toBe('health_check');
            expect(HealthRoutes::HEALTH_LIVENESS->value)->toBe('health_liveness');
        });

        it('returns correct category', function () {
            expect(HealthRoutes::HEALTH_CHECK->getCategory())->toBe(RouteCategory::WEB);
        });

        it('returns correct route type checks', function () {
            expect(HealthRoutes::HEALTH_CHECK->isWebRoute())->toBeTrue();
            expect(HealthRoutes::HEALTH_CHECK->isApiRoute())->toBeFalse();
            expect(HealthRoutes::HEALTH_CHECK->isAdminRoute())->toBeFalse();
            expect(HealthRoutes::HEALTH_CHECK->isAuthRoute())->toBeFalse();
        });
    });

    describe('MediaRoutes', function () {
        it('implements RouteNameInterface correctly', function () {
            expect(MediaRoutes::SHOW_IMAGE)->toBeInstanceOf(\App\Framework\Router\RouteNameInterface::class);
        });

        it('returns correct values', function () {
            expect(MediaRoutes::SHOW_IMAGE->value)->toBe('show_image');
        });

        it('returns correct category', function () {
            expect(MediaRoutes::SHOW_IMAGE->getCategory())->toBe(RouteCategory::MEDIA);
        });

        it('returns correct route type checks', function () {
            expect(MediaRoutes::SHOW_IMAGE->isWebRoute())->toBeFalse();
            expect(MediaRoutes::SHOW_IMAGE->isApiRoute())->toBeFalse();
            expect(MediaRoutes::SHOW_IMAGE->isAdminRoute())->toBeFalse();
            expect(MediaRoutes::SHOW_IMAGE->isAuthRoute())->toBeFalse();
        });
    });
});

describe('RouteCategory', function () {
    it('has correct values', function () {
        expect(RouteCategory::WEB->value)->toBe('web');
        expect(RouteCategory::API->value)->toBe('api');
        expect(RouteCategory::ADMIN->value)->toBe('admin');
        expect(RouteCategory::AUTH->value)->toBe('auth');
        expect(RouteCategory::MEDIA->value)->toBe('media');
    });
});
