<?php

namespace App\Enums;

enum SubscriptionStatus: string
{
    case Trial     = 'trial';
    case Active    = 'active';
    case PastDue   = 'past_due';
    case Cancelled = 'cancelled';
    case Expired   = 'expired';

    public function label(): string
    {
        return match ($this) {
            self::Trial     => 'En prueba',
            self::Active    => 'Activa',
            self::PastDue   => 'Pago vencido',
            self::Cancelled => 'Cancelada',
            self::Expired   => 'Vencida',
        };
    }

    public function color(): string
    {
        return match ($this) {
            self::Trial     => 'amber',
            self::Active    => 'emerald',
            self::PastDue   => 'orange',
            self::Cancelled => 'gray',
            self::Expired   => 'rose',
        };
    }

    public function isActive(): bool
    {
        return in_array($this, [self::Trial, self::Active], true);
    }
}
