<?php

namespace App\Models\Ecommerce\Product\Order\Status;

class OrderStatus
{
    /**
     * Pending orders are brand new orders that have not been processed yet.
     */
    public const PENDING = 'pending';

    /**
     * Orders that has been registered..
     */
    public const REGISTER = 'register';

    /**
     * Orders that has been paid..
     */
    public const PAID = 'paid';

    /**
     * Orders fulfilled completely.
     */
    public const COMPLETED = 'completed';

    /**
     * Order that has been cancelled.
     */
    public const CANCELLED = 'cancelled';

    /**
     * Default status value
     */
    public static function default(): string
    {
        return static::PENDING;
    }

    /**
     * Status Values
     */
    public static function values(): array
    {
        return [
            self::PENDING => __('Pending'),
            self::REGISTER => __('Registered'),
            self::PAID => __('Paid'),
            self::COMPLETED => __('Completed'),
            self::CANCELLED => __('Cancelled'),
        ];
    }

    /**
     * Formatted status for given "status"
     */
    public static function formattedStatusFor(string $status): string
    {
        return static::values()[$status] ?? __('None');
    }

    /**
     * Tailwind
     */
    public static function classes(): array
    {
        return [
            self::PENDING => 'warning',
            self::REGISTER => 'info',
            self::PAID => 'primary',
            self::COMPLETED => 'success',
            self::CANCELLED => 'danger',
        ];
    }

    /**
     * HEX Colors
     */
    public static function colors(): array
    {
        return [
            self::PENDING => '#F5573B',
            self::REGISTER => '#F2CB22',
            self::PAID => '#098F56',
            self::COMPLETED => '#8FC15D',
            self::CANCELLED => '#d70206',
        ];
    }
}
