<?php

namespace App\Repos\Order;

class OrderRepo
{
    /**
     * 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 registered..
     */
    public const PROCESSING = 'processing';

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

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

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

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

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

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

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