<?php

namespace App\Enums;

use App\Enums\Concerns\HasOptions;

/**
 * Subscription billing period.
 */
enum BillingCycle: string
{
    use HasOptions;

    case Monthly = 'monthly';
    case Annual = 'annual';


    /** @return array<string,string> */
    public static function labels(): array
    {
        return [
            self::Monthly->value => 'Monthly',
            self::Annual->value => 'Annual',
        ];
    }

    /** @return array<string,string> */
    public static function colors(): array
    {
        return [
            self::Monthly->value => 'blue',
            self::Annual->value => 'purple',
        ];
    }

    public function months(): int
    {
        return $this === self::Annual ? 12 : 1;
    }

    /** Suffix used next to a price, e.g. "Rs 3,000 / mo". */
    public function suffix(): string
    {
        return $this === self::Annual ? '/ year' : '/ month';
    }
}
