<?php

namespace App\Domains\Forms\Services;

use App\Domains\Purchase\Models\Purchase;

class SaleFormService
{
    /** @return array{statuses: list<array{code: string, name: string}>} */
    public function get(): array
    {
        $names = [
            Purchase::STATUS_CREATED => 'Creada',
            Purchase::STATUS_PENDING_PAYMENT => 'Esperando pago',
            Purchase::STATUS_IN_REVIEW => 'En revisión',
            Purchase::STATUS_PAID => 'Confirmada',
            Purchase::STATUS_CANCELLED => 'Cancelada',
            Purchase::STATUS_REJECTED => 'Rechazada',
            Purchase::STATUS_EXPIRED => 'Vencida',
            Purchase::STATUS_SUPERSEDED => 'Reemplazada',
        ];

        return [
            'statuses' => array_map(
                fn (string $status): array => [
                    'code' => $status,
                    'name' => $names[$status],
                ],
                Purchase::statuses(),
            ),
        ];
    }
}
