<?php

namespace NoahVet\Reef\Domain\Vat;

use NoahVet\Reef\Domain\Common\EnumTrait;
use NoahVet\Reef\Domain\Common\StringEnumInterface;

enum VatCategoryEnum: string implements StringEnumInterface
{
    use EnumTrait;

    // Factur-X Code : S
    // Value : 10%
    case INTERMEDIATE = 'INTERMEDIATE';

    // Factur-X Code : S
    // Value : 8.5%
    case OVERSEAS = 'OVERSEAS';

    // Factur-X Code : S
    // Value : 5.5%
    case REDUCED_RATE = 'REDUCED_RATE';

    // Factur-X Code : S
    // Value : 2.10%
    case SPECIAL_RATE = 'SPECIAL_RATE';

    // Factur-X Code : S
    // Value : 20%
    case STANDARD = 'STANDARD';

    // No vat, equals to 0%

    // Factur-X Code : AE
    // Value : 0
    case REVERSE_CHARGE = 'REVERSE_CHARGE';

    // Factur-X Code : E
    // Value : 0
    case EXEMPT = 'EXEMPT';

    // Factur-X Code : G
    // Value : 0
    case EXEMPT_EXPORT_OUTSIDE_EU = 'EXEMPT_EXPORT_OUTSIDE_EU';

    // Factur-X Code : K
    // Value : 0
    case REVERSE_CHARGE_INTRA_COMMUNITY_SUPPLY = 'REVERSE_CHARGE_INTRA_COMMUNITY_SUPPLY';

    // Factur-X Code : L (IGIC) - Not applicable in France (les canaries and Ceuta)
    // Value : 0
    case ZERO_CODE_L = 'ZERO_CODE_L';

    // Factur-X Code : M (IPSI) — Not applicable in France (Melilla)
    // Value : 0
    case ZERO_CODE_M = 'ZERO_CODE_M';

    // Factur-X Code : O
    // Value : 0
    case EXCLUDED = 'EXCLUDED';

    // Factur-X Code : Z - Not applicable in France
    // Value : 0
    case ZERO_CODE_Z = 'ZERO_CODE_Z';

    public function isPositiveRate(): bool
    {
        return match ($this) {
            self::INTERMEDIATE,
            self::OVERSEAS,
            self::REDUCED_RATE,
            self::SPECIAL_RATE,
            self::STANDARD => true,
            default => false,
        };
    }
}
