<?php

namespace App\Enums;

enum ShippingMethod: string
{
    case Uber = 'Uber';
    case Tienda = 'Tienda';
    case Envio = 'Envio';

    public function label(): string
    {
        return $this->value;
    }

    public function detailStatus(): OrderDetailStatus
    {
        return match ($this) {
            self::Envio => OrderDetailStatus::ListoParaEnviar,
            self::Tienda => OrderDetailStatus::ListoParaRetirar,
            self::Uber => OrderDetailStatus::ListoParaUber,
        };
    }

    /** @return array<string, string> */
    public static function options(): array
    {
        $options = [];

        foreach (self::cases() as $case) {
            $options[$case->value] = $case->label();
        }

        return $options;
    }
}