<?php

namespace EasyLinkAutomations\Auth;

if (!defined('ABSPATH')) {
    exit;
}

/**
 * Supported authentication types.
 */
final class AuthType
{
    public const API_KEY      = 'api_key';
    public const BEARER_TOKEN = 'bearer_token';
    public const BASIC_AUTH   = 'basic_auth';
    public const OAUTH2       = 'oauth2';

    /**
     * All supported auth types.
     *
     * @return array<string, string>
     */
    public static function all(): array
    {
        return [
            self::API_KEY      => 'API Key',
            self::BEARER_TOKEN => 'Bearer Token',
            self::BASIC_AUTH   => 'Basic Auth',
            self::OAUTH2       => 'OAuth2',
        ];
    }

    /**
     * Check if the given auth type is valid.
     */
    public static function isValid(string $type): bool
    {
        return array_key_exists($type, self::all());
    }
}
