<?php

declare(strict_types=1);

namespace App\Framework\Deployment\Ssl\ValueObjects;

/**
 * SSL Certificate Mode - Production or Staging
 *
 * Staging mode uses Let's Encrypt staging servers for testing
 * without hitting rate limits.
 */
enum CertificateMode: string
{
    case PRODUCTION = 'production';
    case STAGING = 'staging';

    public function isProduction(): bool
    {
        return $this === self::PRODUCTION;
    }

    public function isStaging(): bool
    {
        return $this === self::STAGING;
    }

    public function toCertbotFlag(): string
    {
        return $this === self::STAGING ? '--staging' : '';
    }

    public function getDescription(): string
    {
        return match ($this) {
            self::PRODUCTION => 'Production Let\'s Encrypt certificates',
            self::STAGING => 'Staging/Testing Let\'s Encrypt certificates',
        };
    }
}
