<?php

declare(strict_types=1);

namespace App\Support\Ai;

enum AiPolicyMode: string
{
    case Disabled = 'disabled';
    case PrivateOnly = 'private_only';

    public function label(): string
    {
        return match ($this) {
            self::Disabled => 'Disabled',
            self::PrivateOnly => 'Private only',
        };
    }

    public function summary(): string
    {
        return match ($this) {
            self::Disabled => 'No AI execution is allowed for this workspace.',
            self::PrivateOnly => 'Only approved internal drafts may use private-only AI for approved use cases.',
        };
    }

    /**
     * @return array<string, string>
     */
    public static function optionLabels(): array
    {
        return array_reduce(
            self::cases(),
            static function (array $labels, self $mode): array {
                $labels[$mode->value] = $mode->label();

                return $labels;
            },
            [],
        );
    }
}