<?php

declare(strict_types=1);

namespace Autogedal\FeedMonitor\Model;

/**
 * Why a run failed / an alert is open, with the text used in the emails.
 */
class Problem
{
    public const FETCH = 'fetch';
    public const INVALID = 'invalid';
    public const EMPTY = 'empty';
    public const INCOMPLETE = 'incomplete';
    public const EXCEPTION = 'exception';
    public const UPDATE = 'update';
    public const IMPORT = 'import';
    public const STUCK = 'stuck';
    public const STALE = 'stale';
    public const CRON_DOWN = 'cron_down';

    private const LABELS = [
        self::FETCH => 'Feed-ul nu a putut fi citit',
        self::INVALID => 'Feed invalid (format neasteptat)',
        self::EMPTY => 'Feed gol',
        self::INCOMPLETE => 'Feed incomplet (mult mai putine produse decat de obicei)',
        self::EXCEPTION => 'Eroare in timpul rularii',
        self::UPDATE => 'Unele produse nu au putut fi salvate',
        self::IMPORT => 'Importul Firebear a esuat',
        self::STUCK => 'Rularea nu s-a terminat (proces oprit)',
        self::STALE => 'Jobul nu a mai rulat',
        self::CRON_DOWN => 'Cron-ul Magento nu ruleaza',
    ];

    public static function label(string $problem): string
    {
        return self::LABELS[$problem] ?? $problem;
    }
}
