<?php

namespace App\Model;

final class PartitionTypes
{
    private const array PARTITION_TYPES = [
        0 => ['name' => 'EMPTY', 'active' => false],
        1 => ['name' => 'FAT12', 'active' => true],
        5 => ['name' => 'EXTENDED', 'active' => false],
        6 => ['name' => 'FAT16', 'active' => true],
        7 => ['name' => 'NTFS', 'active' => true],
        11 => ['name' => 'FAT32', 'active' => true],
        17 => ['name' => 'HFAT12', 'active' => true],
        22 => ['name' => 'HFAT16', 'active' => true],
        23 => ['name' => 'HNTFS', 'active' => true],
        27 => ['name' => 'HFAT32', 'active' => true],
        130 => ['name' => 'LINUX-SWAP', 'active' => false],
        131 => ['name' => 'LINUX', 'active' => true],
        142 => ['name' => 'LINUX-LVM', 'active' => true],
        165 => ['name' => 'FREEBSD', 'active' => true],
        166 => ['name' => 'OPENBSD', 'active' => true],
        169 => ['name' => 'NETBSD', 'active' => true],
        175 => ['name' => 'HFS', 'active' => true],
        190 => ['name' => 'SOLARIS-BOOT', 'active' => true],
        191 => ['name' => 'SOLARIS', 'active' => true],
        202 => ['name' => 'CACHE', 'active' => false],
        218 => ['name' => 'DATA', 'active' => true],
        238 => ['name' => 'GPT', 'active' => false],
        239 => ['name' => 'EFI', 'active' => true],
        251 => ['name' => 'VMFS', 'active' => true],
        253 => ['name' => 'LINUX-RAID', 'active' => true],
        1792 => ['name' => 'WINDOWS', 'active' => true],
        3073 => ['name' => 'WIN-RESERV', 'active' => true],
        9984 => ['name' => 'WIN-RECOV', 'active' => true],
        32512 => ['name' => 'CHROMEOS-KRN', 'active' => true],
        32513 => ['name' => 'CHROMEOS', 'active' => true],
        32514 => ['name' => 'CHROMEOS-RESERV', 'active' => true],
        33280 => ['name' => 'LINUX-SWAP', 'active' => false],
        33536 => ['name' => 'LINUX', 'active' => true],
        33537 => ['name' => 'LINUX-RESERV', 'active' => true],
        33538 => ['name' => 'LINUX', 'active' => true],
        36352 => ['name' => 'LINUX-LVM', 'active' => true],
        42240 => ['name' => 'FREEBSD-DISK', 'active' => false],
        42241 => ['name' => 'FREEBSD-BOOT', 'active' => true],
        42242 => ['name' => 'FREEBSD-SWAP', 'active' => false],
        42243 => ['name' => 'FREEBSD', 'active' => true],
        42244 => ['name' => 'FREEBSD', 'active' => true],
        43265 => ['name' => 'NETBSD-SWAP', 'active' => false],
        43266 => ['name' => 'NETBSD', 'active' => true],
        43267 => ['name' => 'NETBSD', 'active' => true],
        43268 => ['name' => 'NETBSD', 'active' => true],
        43269 => ['name' => 'NETBSD', 'active' => true],
        43270 => ['name' => 'NETBSD-RAID', 'active' => true],
        43776 => ['name' => 'HFS-BOOT', 'active' => true],
        44800 => ['name' => 'HFS', 'active' => true],
        44801 => ['name' => 'HFS-RAID', 'active' => true],
        44802 => ['name' => 'HFS-RAID', 'active' => true],
        48640 => ['name' => 'SOLARIS-BOOT', 'active' => true],
        48896 => ['name' => 'SOLARIS', 'active' => true],
        48897 => ['name' => 'SOLARIS', 'active' => true],
        48898 => ['name' => 'SOLARIS-SWAP', 'active' => false],
        48899 => ['name' => 'SOLARIS-DISK', 'active' => true],
        48900 => ['name' => 'SOLARIS', 'active' => true],
        48901 => ['name' => 'SOLARIS', 'active' => true],
        51712 => ['name' => 'CACHE', 'active' => false],
        61184 => ['name' => 'EFI', 'active' => true],
        61185 => ['name' => 'MBR', 'active' => false],
        61186 => ['name' => 'BIOS-BOOT', 'active' => false],
        64256 => ['name' => 'VMFS', 'active' => true],
        64257 => ['name' => 'VMFS-RESERV', 'active' => true],
        64258 => ['name' => 'VMFS-KRN', 'active' => true],
        64768 => ['name' => 'LINUX-RAID', 'active' => true],
        65535 => ['name' => 'UNKNOWN', 'active' => true],
        65536 => ['name' => 'LVM-LV', 'active' => true],
        65552 => ['name' => 'ZFS-VOL', 'active' => true],
        39 => ['name' => 'HNTFS-WINRE', 'active' => true],
    ];

    public static function getPartitionTypes(): array
    {
        return self::PARTITION_TYPES;
    }

    public static function getPartitionType(int $code): ?array
    {
        return self::PARTITION_TYPES[$code] ?? null;
    }

    public static function getPartitionKeys(): array
    {
        return array_keys(self::PARTITION_TYPES);
    }
}
