<?php

namespace App\Support;

use App\Models\Ticket;

class TicketStatus
{
    public const OPEN = 'open';
    public const IN_PROGRESS = 'in-progress';
    public const WAITING_CUSTOMER = 'waiting-customer';
    public const WAITING_INTERNAL = 'waiting-internal';
    public const RESOLVED = 'resolved';
    public const CLOSED = 'closed';

    public static function all(): array
    {
        return [
            self::OPEN,
            self::IN_PROGRESS,
            self::WAITING_CUSTOMER,
            self::WAITING_INTERNAL,
            self::RESOLVED,
            self::CLOSED,
        ];
    }

    public static function transitionBlocked(Ticket $ticket, string $nextStatus): bool
    {
        return $ticket->status === self::CLOSED && $nextStatus !== self::CLOSED;
    }

    public static function closedTicketMessage(): string
    {
        return 'Closed tickets cannot be reopened.';
    }
}
