<?php

declare(strict_types=1);

namespace App\Framework\UserAgent\Enums;

/**
 * Enum representing different platform/operating system types
 */
enum PlatformType: string
{
    case WINDOWS = 'windows';
    case MACOS = 'macos';
    case IOS = 'ios';
    case ANDROID = 'android';
    case LINUX = 'linux';
    case CHROME_OS = 'chrome_os';
    case UNKNOWN = 'unknown';

    /**
     * Get human-readable name
     */
    public function getDisplayName(): string
    {
        return match ($this) {
            self::WINDOWS => 'Windows',
            self::MACOS => 'macOS',
            self::IOS => 'iOS',
            self::ANDROID => 'Android',
            self::LINUX => 'Linux',
            self::CHROME_OS => 'Chrome OS',
            self::UNKNOWN => 'Unknown',
        };
    }

    /**
     * Check if platform is mobile
     */
    public function isMobile(): bool
    {
        return match ($this) {
            self::IOS, self::ANDROID => true,
            self::WINDOWS, self::MACOS, self::LINUX, self::CHROME_OS, self::UNKNOWN => false,
        };
    }

    /**
     * Check if platform is desktop
     */
    public function isDesktop(): bool
    {
        return match ($this) {
            self::WINDOWS, self::MACOS, self::LINUX, self::CHROME_OS => true,
            self::IOS, self::ANDROID, self::UNKNOWN => false,
        };
    }

    /**
     * Get platform family
     */
    public function getFamily(): string
    {
        return match ($this) {
            self::WINDOWS => 'Microsoft',
            self::MACOS, self::IOS => 'Apple',
            self::ANDROID => 'Google',
            self::LINUX => 'Unix-like',
            self::CHROME_OS => 'Google',
            self::UNKNOWN => 'Unknown',
        };
    }
}
