using System;
using Tornado3_2026Election.Domain;

namespace Tornado3_2026Election.Services;

public static class CutListElectionCategoryResolver
{
    public static CutListElectionCategory Resolve(string? formatName)
    {
        var resolvedFormatName = formatName ?? string.Empty;

        if (resolvedFormatName.Contains("\uAD50\uC721\uAC10", StringComparison.Ordinal))
        {
            return CutListElectionCategory.Superintendent;
        }

        if (resolvedFormatName.Contains("\uAE30\uCD08\uC758\uC6D0", StringComparison.Ordinal))
        {
            return CutListElectionCategory.LocalCouncil;
        }

        if (resolvedFormatName.Contains("\uAE30\uCD08\uB2E8\uCCB4\uC7A5", StringComparison.Ordinal))
        {
            return CutListElectionCategory.LocalHead;
        }

        if (resolvedFormatName.Contains("\uAD11\uC5ED\uC758\uC6D0", StringComparison.Ordinal))
        {
            return CutListElectionCategory.MetropolitanCouncil;
        }

        if (resolvedFormatName.Contains("\uAD11\uC5ED\uB2E8\uCCB4\uC7A5", StringComparison.Ordinal) ||
            resolvedFormatName.Contains("\uBCF4\uAADC\uC120\uAC70", StringComparison.Ordinal))
        {
            return CutListElectionCategory.MetropolitanHead;
        }

        return CutListElectionCategory.MetropolitanHead;
    }

    public static string GetLabel(CutListElectionCategory category)
    {
        return category switch
        {
            CutListElectionCategory.MetropolitanCouncil => "\uAD11\uC5ED\uC758\uC6D0",
            CutListElectionCategory.Superintendent => "\uAD50\uC721\uAC10",
            CutListElectionCategory.LocalHead => "\uAE30\uCD08\uB2E8\uCCB4\uC7A5",
            CutListElectionCategory.LocalCouncil => "\uAE30\uCD08\uC758\uC6D0",
            _ => "\uAD11\uC5ED\uB2E8\uCCB4\uC7A5"
        };
    }
}
