using System;
using System.Collections.Generic;

namespace StellaOps.Feedser.Source.Kisa.Internal;

internal static class KisaDocumentMetadata
{
    public static Dictionary<string, string> CreateMetadata(KisaFeedItem item)
    {
        var metadata = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
        {
            ["kisa.idx"] = item.AdvisoryId,
            ["kisa.detailPage"] = item.DetailPageUri.ToString(),
            ["kisa.published"] = item.Published.ToString("O"),
        };

        if (!string.IsNullOrWhiteSpace(item.Title))
        {
            metadata["kisa.title"] = item.Title!;
        }

        if (!string.IsNullOrWhiteSpace(item.Category))
        {
            metadata["kisa.category"] = item.Category!;
        }

        return metadata;
    }
}
