<?php

namespace Daylight\Core\Models\Enums;

use Illuminate\Support\Collection;

enum PublishStatus: int
{
    case DRAFT = 0;

    case PUBLISHED = 1;

    public function label(): string
    {
        return match ($this) {
            self::DRAFT => __('daylight::general.draft'),
            self::PUBLISHED => __('daylight::general.published'),
        };
    }

    public function adminColor(): string
    {
        return match ($this) {
            self::PUBLISHED => 'bg-green-50 text-green-700',
            self::DRAFT => 'bg-yellow-50 text-yellow-700',
        };
    }

    public static function formattedValues(): Collection
    {
        return collect(self::cases())
            ->mapWithKeys(function (PublishStatus $status) {
                return [$status->value => $status->label()];
            });
    }
}
