local M = {}

M.catalogVersion = 3
M.catalogCodename = "Analog Memory"

local function listToMap(ids, value)
    local mapped = {}
    for _, id in ipairs(ids or {}) do
        mapped[id] = value
    end
    return mapped
end

local function mergeInto(target, source)
    for key, value in pairs(source or {}) do
        target[key] = value
    end
    return target
end

local PUBLIC_LABELS = {
    portra_160 = "Kodak Portra 160 Legacy Control [LAB]",
    portra_160_accurate_prototype = "Kodak Portra 160 [A]",
    portra_400 = "Kodak Portra 400 Legacy Control [LAB]",
    portra_400_accurate_prototype = "Kodak Portra 400 [A]",
    portra_800_accurate_prototype = "Kodak Portra 800 [A]",
    portra_800 = "Kodak Portra 800 Legacy Control [LAB]",
    gold_200 = "Kodak Gold 200 [C]",
    colorplus_200 = "Kodak ColorPlus 200 [C]",
    ektar_100 = "Kodak Ektar 100 [C]",
    ultramax_400 = "Kodak UltraMax 400 [C]",
    ektachrome = "Kodak Ektachrome E100 Creative Base [LAB]",
    cinestill_800t = "CineStill 800T [C]",
    cinestill_50d = "CineStill 50D [C]",
    fuji_400h = "Fujifilm Pro 400H Legacy Control [LAB]",
    fuji_400h_accurate_prototype = "Fujifilm Pro 400H [A]",
    fuji_superia_400 = "Fujifilm Superia X-TRA 400 [C]",
    fuji_natura_1600 = "Fujifilm Natura 1600 [C]",
    fuji_superia_1600 = "Fujifilm Superia 1600 [C]",
    fuji_velvia_50 = "Fujifilm Velvia 50 [C]",
    fuji_astia_100f = "Fujifilm Astia 100F [C]",
    fuji_provia_100f = "Fujifilm Provia 100F [A]",
    fuji_provia_rx = "Fujifilm Provia 400X [C]",
    fuji_fortia_50 = "Fujifilm Fortia 50 [C]",
    vision3_50d = "Kodak Vision3 50D [C]",
    vision3_250d = "Kodak Vision3 250D [C]",
    vision3_200t = "Kodak Vision3 200T [C]",
    vision3_200t_plus = "Kodak Vision3 200T+ [C]",
    vision3_500t = "Kodak Vision3 500T [A]",
    kodachrome_25 = "Kodachrome 25 Legacy Duplicate [LAB]",
    kodachrome_64 = "Kodak Kodachrome 64 Legacy Control [LAB]",
    kodak_oktar = "Clean Color 100",
    agfa_precisa = "AgfaPhoto CT Precisa 100 [C]",
    redscale_ultra = "Amber Reverse",
    harman_phoenix = "Ember Color",
    gaf_500 = "Retro Color 500",
    eastman_cn_ii_100 = "Eastman Color Negative II 100 [C]",
    kodak_solara_100 = "Sun Color 100",
    bw_trix_400 = "Kodak Tri-X 400 [C]",
    bw_trix_1600 = "Kodak Tri-X 1600 [C]",
    bw_xp2 = "Ilford XP2 Super 400 [C]",
    bw_tmax_400 = "Kodak T-Max 400 [C]",
    bw_tmax_100 = "Kodak T-Max 100 [C]",
    bw_foma_100 = "Fomapan 100 [C]",
    bw_arista_edu_100 = "Arista EDU Ultra 400 [C]",
    bw_hp5 = "Ilford HP5 Plus 400 [C]",
    bw_delta_3200 = "Ilford Delta 3200 [C]",
    bw_kosmo_pan = "Kosmo Foto Mono 100 [C]",
    bw_vision = "Kodak Vision3 B&W Experimental Branch [LAB]",
    bw_foma_400 = "Fomapan 400 [C]",
    bw_delta_100 = "Ilford Delta 100 [C]",
    sony_standard_cl = "Clean Standard",
    vektro100 = "Vektro 100",
    senova_light = "Senova Light",
    evproplus = "EV Pro Plus",
    kodak_gold_v1 = "Kodak Gold 200 Print Variant I [LAB]",
    kodak_gold_v2 = "Kodak Gold 200 Print Variant II [LAB]",
    kodachrome_v1 = "Kodachrome V1 [Creative]",
    kodachrome_v2 = "Kodachrome V2 [Creative]",
    kodachrome_v3 = "Kodak Kodachrome 64 Creative Variant [LAB]",
    leicachrome = "Leicachrome [A]",
    velvia_pro = "Velvia Pro [Landscape]",
    classic_chrome = "Classic Chrome",
    pro_neg_std = "Pro Negative Soft",
    sony_classic_negative = "Classic Negative",
    fuji_nostalgic_neg = "Nostalgic Negative",
    fuji_eterna = "Fujifilm Eterna [C]",
    sony_eterna = "Sony Eterna Digital Simulation [LAB]",
    acros_x = "Fujifilm Acros Experimental Branch [LAB]",
    acros_xy = "Fujifilm Acros Yellow Filter Sim [LAB]",
    acros_xr = "Fujifilm Acros Red Filter Sim [LAB]",
    acros_xg = "Fujifilm Acros Green Filter Sim [LAB]",
    sony_nostalgic_neg = "Nostalgic Color",
    classic_cinema = "Classic Cinema Creative Branch [LAB]",
    oktar = "Oktar",
    zero_mute = "Zero Mute",
    cinechrome = "CineChrome Creative Branch [LAB]",
    procolor = "ProColor",
    blue_velvet_cinestill_50d = "Blue Velvet CineStill 50D Creative Branch [LAB]",
    cinestill_800 = "CineStill 800 [C]",
    cinestill_x = "CineStill X Experimental Branch [LAB]",
    chroma_fade = "Chroma Fade",
    neo_max = "Neo Max",
    midred_infra = "MidRed Infra",
    dreamneg = "DreamNeg",
    zetra_100 = "Zetra 100",
    rose_spectra = "Rose Spectra",
    asteroid_city_kodak_vision_t200_v1 = "Asteroid City Kodak Vision T200 V1 Creative Branch [LAB]",
    asteroid_city_kodak_vision_t200_v2 = "Asteroid City Kodak Vision T200 V2 Creative Branch [LAB]",
    ayon_200 = "Ayon 200",
    phoenix_harman = "Phoenix Ember",
    phenomena = "Phenomena",
    crimson = "Crimson",
    acidnom = "Acidnom Duplicate Borrower [LAB]",
    estra_500 = "Estra 500",
    x_tarr = "X-Tarr",
    magic_spice = "Magic Spice",
    amarelo_30d = "Amarelo 30D",
    vespera = "Vespera",
    veniliqum = "Veniliqum",
    gold_luxe = "Gold Luxe",
    fuji_400h_cc = "Pastel Archive 400",
    ektar_100_cc = "Kodak Ektar 100 Creative Control [LAB]",
    kodak_color_plus_200_cc = "Kodak ColorPlus 200 Creative Control [LAB]",
    ektachrome_cc = "Kodak Ektachrome E100 Creative Chrome [LAB]",
    fuji_provia_cc = "Clean Chrome 100",
    provia_rx_cc = "Fujifilm Provia 400X Legacy Duplicate [LAB]",
    astia_cc = "Fujifilm Astia 100F Legacy Duplicate [LAB]",
    fortia_50_cc = "Fujifilm Fortia 50 Legacy Duplicate [LAB]",
    tmax100_cc = "Kodak T-Max 100 Creative Control [LAB]",
    delta_3200_cc = "Ilford Delta 3200 Creative Control [LAB]",
    ilford_hp5_cc = "Ilford HP5 Plus 400 Creative Control [LAB]",
    redscale_ultra_cc = "Redscale Ultra Legacy Duplicate [LAB]",
    solara_100_cc = "Kodak Solara 100 Legacy Duplicate [LAB]",
    agfa_scala_200x = "Agfa Scala 200x Duplicate Borrower [LAB]",
    agfa_rsx_ii_200 = "Agfa RSX II 200 Fork Required [LAB]",
    agfa_portrait_xps_160 = "Agfa Portrait XPS 160 Duplicate Borrower [LAB]",
    konica_centuria_100 = "Konica Centuria 100 [C]",
    konica_impresa_50 = "Konica Impresa 50 Duplicate Borrower [LAB]",
    lomochrome_metropolis = "LomoChrome Metropolis Duplicate Borrower [LAB]",
    lomochrome_purple = "LomoChrome Purple Duplicate Borrower [LAB]",
    fuji_fp100c = "Fuji FP-100c Instant Fork Required [LAB]",
    fuji_instax = "Fuji Instax Instant Fork Required [LAB]",
    fuji_reala_500d = "Fujifilm Reala 500D [C]",
    orwo_chrom_ut21 = "ORWO Chrom UT21 Duplicate Borrower [LAB]",
    svema_type_42 = "Svema Type 42 Duplicate Borrower [LAB]",
    rollei_ortho_25 = "Rollei Ortho 25 [C]",
    polaroid_polachrome = "Polaroid PolaChrome Duplicate Borrower [LAB]",
    ferrania_p30 = "Ferrania P30 Duplicate Borrower [LAB]",
    adox_color_implosion = "Adox Color Implosion Duplicate Borrower [LAB]",
    kodak_aerocolor_iv = "Kodak Aerocolor IV Duplicate Borrower [LAB]",
    kodak_ektachrome_e100g = "Kodak Ektachrome E100G Duplicate Borrower [LAB]",
    kodak_pro_image_100 = "Kodak Pro Image 100 [C]",
    cinestill_400d = "CineStill 400D Blocked Borrower [LAB]",
    ektachrome_accurate_prototype = "Kodak Ektachrome E100 [A]",
    portra_400_skinsafe_prototype = "Kodak Portra 400 Skin-Safe",
    kodachrome_64_accurate_prototype = "Kodak Kodachrome 64 [A]",
}

-- Per-emulsion customer suffix overrides (full label = PUBLIC_LABELS[id] .. " | " .. suffix).
local CLIENT_LABEL_SUFFIX_BY_ID = {
    kodachrome_v3 = "Internal Lab Control",
    kodachrome_64 = "Internal Lab Control",
    kodachrome_64_accurate_prototype = "Inspired by MindfulLens",
    leicachrome = "Inspired by MindfulLens",
    fuji_provia_100f = "Inspired by MindfulLens",
    fuji_velvia_50 = "Inspired by MindfulLens",
    ektachrome = "Internal Lab Control",
    ektachrome_cc = "Internal Lab Control",
    ektachrome_accurate_prototype = "Inspired by MindfulLens",
    fuji_provia_cc = "Creative by MindfulLens",
    fuji_400h = "Internal Lab Control",
    fuji_400h_accurate_prototype = "Inspired by MindfulLens",
    fuji_400h_cc = "Creative by MindfulLens",
    portra_400_accurate_prototype = "Inspired by MindfulLens",
    portra_800_accurate_prototype = "Inspired by MindfulLens",
    portra_160_accurate_prototype = "Inspired by MindfulLens",
    portra_400_skinsafe_prototype = "Inspired by MindfulLens",
    portra_160 = "Internal Lab Control",
    portra_400 = "Internal Lab Control",
    portra_800 = "Internal Lab Control",
    kodak_gold_v1 = "Internal Lab Control",
    kodak_gold_v2 = "Internal Lab Control",
    kodak_pro_image_100 = "Inspired by MindfulLens",
    acidnom = "Internal Lab Control",
    adox_color_implosion = "Internal Lab Control",
    lomochrome_metropolis = "Internal Lab Control",
    lomochrome_purple = "Internal Lab Control",
    agfa_portrait_xps_160 = "Internal Lab Control",
    agfa_rsx_ii_200 = "Internal Lab Control",
    kodak_ektachrome_e100g = "Internal Lab Control",
    kodak_aerocolor_iv = "Internal Lab Control",
    konica_impresa_50 = "Internal Lab Control",
    fuji_fp100c = "Internal Lab Control",
    fuji_instax = "Internal Lab Control",
    astia_cc = "Internal Lab Control",
    fortia_50_cc = "Internal Lab Control",
    provia_rx_cc = "Internal Lab Control",
    solara_100_cc = "Internal Lab Control",
    redscale_ultra_cc = "Internal Lab Control",
    kodachrome_25 = "Internal Lab Control",
    fuji_reala_500d = "Inspired by MindfulLens",
    cinestill_400d = "Internal Lab Control",
    orwo_chrom_ut21 = "Internal Lab Control",
    agfa_scala_200x = "Internal Lab Control",
    ferrania_p30 = "Internal Lab Control",
    svema_type_42 = "Internal Lab Control",
    tmax100_cc = "Internal Lab Control",
    ilford_hp5_cc = "Internal Lab Control",
    delta_3200_cc = "Internal Lab Control",
    bw_vision = "Internal Lab Control",
    acros_x = "Internal Lab Control",
    acros_xy = "Internal Lab Control",
    acros_xr = "Internal Lab Control",
    acros_xg = "Internal Lab Control",
    sony_eterna = "Internal Lab Control",
    classic_cinema = "Internal Lab Control",
    cinestill_x = "Internal Lab Control",
    blue_velvet_cinestill_50d = "Internal Lab Control",
    asteroid_city_kodak_vision_t200_v1 = "Internal Lab Control",
    asteroid_city_kodak_vision_t200_v2 = "Internal Lab Control",
    cinechrome = "Internal Lab Control",
    polaroid_polachrome = "Internal Lab Control",
    cinestill_800t = "Inspired by MindfulLens",
    cinestill_50d = "Inspired by MindfulLens",
    cinestill_800 = "Inspired by MindfulLens",
    vision3_500t = "Inspired by MindfulLens",
    vision3_50d = "Inspired by MindfulLens",
    vision3_250d = "Inspired by MindfulLens",
    vision3_200t = "Inspired by MindfulLens",
    vision3_200t_plus = "Inspired by MindfulLens",
    fuji_eterna = "Inspired by MindfulLens",
    eastman_cn_ii_100 = "Inspired by MindfulLens",
    gold_200 = "Inspired by MindfulLens",
    colorplus_200 = "Inspired by MindfulLens",
    konica_centuria_100 = "Inspired by MindfulLens",
    kodak_color_plus_200_cc = "Internal Lab Control",
    ektar_100 = "Inspired by MindfulLens",
    ektar_100_cc = "Internal Lab Control",
    ultramax_400 = "Inspired by MindfulLens",
    fuji_superia_400 = "Inspired by MindfulLens",
    fuji_natura_1600 = "Inspired by MindfulLens",
    fuji_superia_1600 = "Inspired by MindfulLens",
    fuji_astia_100f = "Inspired by MindfulLens",
    agfa_precisa = "Inspired by MindfulLens",
    fuji_provia_rx = "Inspired by MindfulLens",
    fuji_fortia_50 = "Inspired by MindfulLens",
    bw_hp5 = "Inspired by MindfulLens",
    bw_delta_100 = "Inspired by MindfulLens",
    bw_trix_400 = "Inspired by MindfulLens",
    bw_tmax_400 = "Inspired by MindfulLens",
    bw_foma_100 = "Inspired by MindfulLens",
    bw_foma_400 = "Inspired by MindfulLens",
    bw_tmax_100 = "Inspired by MindfulLens",
    bw_delta_3200 = "Inspired by MindfulLens",
    bw_xp2 = "Inspired by MindfulLens",
    bw_trix_1600 = "Inspired by MindfulLens",
    rollei_ortho_25 = "Inspired by MindfulLens",
    bw_arista_edu_100 = "Inspired by MindfulLens",
    bw_kosmo_pan = "Inspired by MindfulLens",
    -- Phase 3W-18E: public creative collection profiles (EMULSION_CREATIVE_COLLECTION_BY_ID).
    amarelo_30d = "Creative by MindfulLens",
    ayon_200 = "Creative by MindfulLens",
    chroma_fade = "Creative by MindfulLens",
    classic_chrome = "Creative by MindfulLens",
    crimson = "Creative by MindfulLens",
    dreamneg = "Creative by MindfulLens",
    estra_500 = "Creative by MindfulLens",
    evproplus = "Creative by MindfulLens",
    fuji_nostalgic_neg = "Creative by MindfulLens",
    gaf_500 = "Creative by MindfulLens",
    gold_luxe = "Creative by MindfulLens",
    harman_phoenix = "Creative by MindfulLens",
    kodachrome_v1 = "Creative by MindfulLens",
    kodachrome_v2 = "Creative by MindfulLens",
    kodak_oktar = "Creative by MindfulLens",
    kodak_solara_100 = "Creative by MindfulLens",
    magic_spice = "Creative by MindfulLens",
    midred_infra = "Creative by MindfulLens",
    neo_max = "Creative by MindfulLens",
    oktar = "Creative by MindfulLens",
    phenomena = "Creative by MindfulLens",
    phoenix_harman = "Creative by MindfulLens",
    pro_neg_std = "Creative by MindfulLens",
    procolor = "Creative by MindfulLens",
    redscale_ultra = "Creative by MindfulLens",
    rose_spectra = "Creative by MindfulLens",
    senova_light = "Creative by MindfulLens",
    sony_classic_negative = "Creative by MindfulLens",
    sony_nostalgic_neg = "Creative by MindfulLens",
    sony_standard_cl = "Creative by MindfulLens",
    vektro100 = "Creative by MindfulLens",
    velvia_pro = "Creative by MindfulLens",
    veniliqum = "Creative by MindfulLens",
    vespera = "Creative by MindfulLens",
    x_tarr = "Creative by MindfulLens",
    zero_mute = "Creative by MindfulLens",
    zetra_100 = "Creative by MindfulLens",
}

local CATEGORY_ORDER = {
    "portrait_skin",
    "golden_hour",
    "landscape_travel",
    "night_city",
    "documentary_street",
    "cinema_storytelling",
    "studio_fineart",
    "vintage_lofi",
    "experimental",
}

local CATEGORY_META = {
    portrait_skin = {
        title = "Portret i Skora",
        prefix = "PORTRET | ",
        code = "POR",
        short = "Subtelne tony skory, miekkie przejscia i spokojny kontrast.",
    },
    golden_hour = {
        title = "Zlota Godzina",
        prefix = "ZLOTA GODZINA | ",
        code = "ZG",
        short = "Cieple swiatlo, nostalgia i sloneczny charakter kadru.",
    },
    landscape_travel = {
        title = "Krajobraz i Podroze",
        prefix = "KRAJOBRAZ | ",
        code = "KRA",
        short = "Nasycone niebo, zielen i detal do natury oraz podrozy.",
    },
    night_city = {
        title = "Noc i Miasto",
        prefix = "NOC | ",
        code = "NOC",
        short = "Sztuczne swiatlo, neony, tungsten i wysoka czulosc.",
    },
    documentary_street = {
        title = "Reportaz i Ulica",
        prefix = "REPORTAZ | ",
        code = "REP",
        short = "Surowosc, rytm miasta i elastycznosc codziennego dokumentu.",
    },
    cinema_storytelling = {
        title = "Kino i Storytelling",
        prefix = "KINO | ",
        code = "KIN",
        short = "Szeroka tonacja i filmowy przebieg koloru pod opowiesc.",
    },
    studio_fineart = {
        title = "Studio i Fine-Art",
        prefix = "FINE-ART | ",
        code = "FA",
        short = "Precyzja, spokoj, czysta forma i kontrola tonalna.",
    },
    vintage_lofi = {
        title = "Vintage i Lo-Fi",
        prefix = "VINTAGE | ",
        code = "VIN",
        short = "Retro chemia, nostalgia i celowo starszy charakter obrazu.",
    },
    experimental = {
        title = "Eksperymentalne",
        prefix = "EKSPERYMENT | ",
        code = "EXP",
        short = "Niestandardowa paleta, efekty specjalne i autorskie odchylenia.",
    },
}

local EMULSION_CATEGORY_BY_ID = {}

mergeInto(EMULSION_CATEGORY_BY_ID, listToMap({
    "portra_160",
    "portra_400",
    "fuji_400h",
    "fuji_400h_accurate_prototype",
    "fuji_astia_100f",
    "cinechrome",
    "evproplus",
    "senova_light",
    "veniliqum",
    "pro_neg_std",
    "fuji_400h_cc",
    "astia_cc",
    "agfa_portrait_xps_160",
    "kodak_pro_image_100",
    "portra_400_skinsafe_prototype",
    "portra_160_accurate_prototype",
    "portra_400_accurate_prototype",
    "portra_800_accurate_prototype",
    "fuji_reala_500d",
}, "portrait_skin"))

mergeInto(EMULSION_CATEGORY_BY_ID, listToMap({
    "gold_200",
    "colorplus_200",
    "kodak_solara_100",
    "ultramax_400",
    "kodak_gold_v1",
    "kodak_gold_v2",
    "gold_luxe",
    "amarelo_30d",
    "magic_spice",
    "ayon_200",
    "kodak_color_plus_200_cc",
    "solara_100_cc",
    "konica_centuria_100",
    "fuji_provia_cc",
}, "golden_hour"))

mergeInto(EMULSION_CATEGORY_BY_ID, listToMap({
    "ektar_100",
    "ektachrome",
    "fuji_velvia_50",
    "fuji_provia_100f",
    "fuji_provia_rx",
    "fuji_fortia_50",
    "agfa_precisa",
    "velvia_pro",
    "kodak_oktar",
    "oktar",
    "vektro100",
    "zetra_100",
    "procolor",
    "ektar_100_cc",
    "ektachrome_cc",
    "provia_rx_cc",
    "fortia_50_cc",
    "agfa_rsx_ii_200",
    "kodak_aerocolor_iv",
    "kodak_ektachrome_e100g",
    "ektachrome_accurate_prototype",
}, "landscape_travel"))

mergeInto(EMULSION_CATEGORY_BY_ID, listToMap({
    "cinestill_800t",
    "cinestill_800",
    "vision3_500t",
    "vision3_200t",
    "vision3_200t_plus",
    "portra_800",
    "asteroid_city_kodak_vision_t200_v1",
    "asteroid_city_kodak_vision_t200_v2",
    "cinestill_x",
    "vespera",
}, "night_city"))

mergeInto(EMULSION_CATEGORY_BY_ID, listToMap({
    "fuji_superia_400",
    "fuji_natura_1600",
    "fuji_superia_1600",
    "bw_trix_400",
    "bw_hp5",
    "bw_foma_400",
    "bw_tmax_400",
    "bw_xp2",
    "bw_arista_edu_100",
    "bw_kosmo_pan",
    "classic_chrome",
    "crimson",
    "x_tarr",
    "sony_classic_negative",
    "sony_standard_cl",
    "gaf_500",
    "ilford_hp5_cc",
    "agfa_scala_200x",
    "svema_type_42",
}, "documentary_street"))

mergeInto(EMULSION_CATEGORY_BY_ID, listToMap({
    "fuji_eterna",
    "vision3_250d",
    "vision3_50d",
    "eastman_cn_ii_100",
    "sony_eterna",
    "classic_cinema",
    "cinestill_50d",
    "blue_velvet_cinestill_50d",
    "bw_vision",
    "cinestill_400d",
}, "cinema_storytelling"))

mergeInto(EMULSION_CATEGORY_BY_ID, listToMap({
    "bw_delta_100",
    "bw_tmax_100",
    "bw_foma_100",
    "acros_x",
    "acros_xy",
    "acros_xr",
    "acros_xg",
    "zero_mute",
    "tmax100_cc",
    "konica_impresa_50",
    "rollei_ortho_25",
    "ferrania_p30",
}, "studio_fineart"))

mergeInto(EMULSION_CATEGORY_BY_ID, listToMap({
    "kodachrome_25",
    "kodachrome_64",
    "kodachrome_64_accurate_prototype",
    "harman_phoenix",
    "phoenix_harman",
    "leicachrome",
    "kodachrome_v1",
    "kodachrome_v2",
    "kodachrome_v3",
    "fuji_nostalgic_neg",
    "sony_nostalgic_neg",
    "acidnom",
    "chroma_fade",
    "neo_max",
    "redscale_ultra",
    "redscale_ultra_cc",
    "fuji_fp100c",
    "fuji_instax",
    "orwo_chrom_ut21",
    "polaroid_polachrome",
}, "vintage_lofi"))

mergeInto(EMULSION_CATEGORY_BY_ID, listToMap({
    "delta_3200_cc",
    "bw_trix_1600",
    "bw_delta_3200",
    "dreamneg",
    "midred_infra",
    "rose_spectra",
    "phenomena",
    "estra_500",
    "lomochrome_metropolis",
    "lomochrome_purple",
    "adox_color_implosion",
}, "experimental"))

-- Phase 3W-18C-IMPLEMENT: product collections for public creative non-[A]/[C] (mood categories unchanged).
local CREATIVE_COLLECTION_ORDER = {
    "creative_main",
    "creative_vibes",
    "creative_digital_sim",
    "creative_landscape",
    "creative_social",
    "creative_experimental",
}

local CREATIVE_COLLECTION_META = {
    creative_main = {
        collectionCode = "MAIN_PUBLIC_CREATIVE",
        title = "Glowna Kreacja",
        short = "Kreacyjne looki uliczne, studyjne i chrome poza stock Core.",
    },
    creative_vibes = {
        collectionCode = "CREATIVE_VIBES_COLLECTION",
        title = "MindfulLens Vibes",
        short = "Cieple, nostalgiczne i stylizowane looki MindfulLens Vibes.",
    },
    creative_digital_sim = {
        collectionCode = "DIGITAL_SIM_COLLECTION",
        title = "Symulacje Cyfrowe",
        short = "Symulacje cyfrowego filmu w stylu Fujifilm i Sony.",
    },
    creative_landscape = {
        collectionCode = "LANDSCAPE_TRAVEL_CREATIVE",
        title = "Kreacja Krajobraz i Podroze",
        short = "Kreacyjny kolor krajobrazowy poza stockowymi grupami slide.",
    },
    creative_social = {
        collectionCode = "SOCIAL_LOOKS_COLLECTION",
        title = "Looki Social",
        short = "Zlota godzina, portret casual i stylizowany kolor pod social.",
    },
    creative_experimental = {
        collectionCode = "EXPERIMENTAL_PUBLIC_COLLECTION",
        title = "Looki Eksperymentalne",
        short = "Publiczne kreacyjne looki o nietypowej palecie i charakterze.",
    },
}

local EMULSION_CREATIVE_COLLECTION_BY_ID = {}

mergeInto(EMULSION_CREATIVE_COLLECTION_BY_ID, listToMap({
    "crimson",
    "kodachrome_v1",
    "kodachrome_v2",
    "x_tarr",
    "zero_mute",
    "gaf_500",
}, "creative_main"))

mergeInto(EMULSION_CREATIVE_COLLECTION_BY_ID, listToMap({
    "chroma_fade",
    "magic_spice",
    "neo_max",
    "phoenix_harman",
    "vespera",
    "harman_phoenix",
}, "creative_vibes"))

mergeInto(EMULSION_CREATIVE_COLLECTION_BY_ID, listToMap({
    "classic_chrome",
    "fuji_nostalgic_neg",
    "pro_neg_std",
    "sony_classic_negative",
    "sony_nostalgic_neg",
    "sony_standard_cl",
}, "creative_digital_sim"))

mergeInto(EMULSION_CREATIVE_COLLECTION_BY_ID, listToMap({
    "oktar",
    "procolor",
    "vektro100",
    "velvia_pro",
    "zetra_100",
    "kodak_oktar",
}, "creative_landscape"))

mergeInto(EMULSION_CREATIVE_COLLECTION_BY_ID, listToMap({
    "amarelo_30d",
    "ayon_200",
    "evproplus",
    "gold_luxe",
    "senova_light",
    "veniliqum",
    "kodak_solara_100",
}, "creative_social"))

mergeInto(EMULSION_CREATIVE_COLLECTION_BY_ID, listToMap({
    "dreamneg",
    "estra_500",
    "midred_infra",
    "phenomena",
    "rose_spectra",
    "redscale_ultra",
}, "creative_experimental"))

local EMULSION_CREATIVE_COLLECTION_ROLE_DOC_BY_ID = listToMap({
    "gaf_500",
    "harman_phoenix",
    "kodak_oktar",
    "kodak_solara_100",
    "redscale_ultra",
}, true)

local EMULSION_TAGS_BY_ID = {
    portra_160 = { "legacy-control", "internal", "lab-only", "do-not-ship", "superseded-by-accurate", "portra", "160" },
    portra_160_accurate_prototype = { "portrait", "bridal", "beauty", "daylight", "window-light", "pastel-skin", "kodak", "portra", "160", "accurate" },
    portra_400 = { "legacy-control", "internal", "lab-only", "do-not-ship", "superseded-by-accurate", "portra", "400" },
    portra_400_accurate_prototype = { "portrait", "wedding", "skin", "portra", "kodak", "c41", "frontier", "accurate", "400" },
    portra_400_skinsafe_prototype = { "portra", "400", "skin-safe", "portrait", "fine-art", "wedding", "soft-skin", "low-redness", "color-negative", "film-negative", "optional-branch" },
    portra_800_accurate_prototype = { "portrait", "wedding", "indoor", "reception", "low-light", "warm-negative", "kodak", "portra", "800", "accurate" },
    portra_800 = { "legacy-control", "internal", "lab-only", "do-not-ship", "superseded-by-accurate", "portra", "800", "night-city" },
    fuji_400h = { "legacy-control", "internal", "lab-only", "do-not-ship", "superseded-by-accurate", "portret", "120", "pastel" },
    fuji_400h_accurate_prototype = { "portrait", "wedding", "skin", "pastel", "frontier", "accurate", "120", "open-shade" },
    fuji_400h_cc = { "pastel", "archive", "400", "portrait", "high-key", "editorial", "soft-color", "creative-negative", "creative-by-mindfullens" },
    fuji_superia_400 = { "fujifilm", "superia", "x-tra", "c-41", "consumer-fuji", "color-negative", "daylight", "travel", "street", "family", "400", "creative" },
    fuji_natura_1600 = { "fujifilm", "natura", "c-41", "consumer-fuji", "high-iso", "night", "available-light", "street", "travel", "1600", "creative" },
    fuji_superia_1600 = { "fujifilm", "superia", "c-41", "consumer-fuji", "high-iso", "night", "available-light", "snapshot", "travel", "1600", "creative" },
    fuji_astia_100f = { "fujifilm", "astia", "slide", "reversal", "e-6", "portrait-slide", "soft-color", "daylight", "editorial", "100f", "creative" },
    fuji_fortia_50 = { "fujifilm", "fortia", "slide", "reversal", "e-6", "chrome", "vivid", "landscape", "nature", "color", "50", "creative" },
    gold_200 = { "consumer-kodak", "golden-hour", "family", "travel", "daylight", "summer", "lifestyle", "warm", "nostalgic", "35mm" },
    konica_centuria_100 = { "konica", "centuria", "100", "c-41", "daylight", "color-negative", "consumer", "nostalgic", "soft-color", "compact-camera", "film-negative" },
    kodak_gold_v1 = { "internal", "lab-only", "do-not-ship", "creative-variant", "superseded-by-gold-200", "golden-hour" },
    kodak_gold_v2 = { "internal", "lab-only", "do-not-ship", "creative-variant", "superseded-by-gold-200", "golden-hour" },
    kodak_pro_image_100 = { "kodak", "pro-image", "100", "c-41", "daylight", "portrait", "skin", "natural-color", "professional", "color-negative", "film-negative" },
    fuji_reala_500d = { "fujifilm", "reala", "500d", "c-41", "daylight", "professional", "natural-color", "neutral-skin", "green-control", "color-negative", "film-negative" },
    cinestill_400d = { "internal", "lab-only", "do-not-ship", "blocked-pending-fork", "borrower-risk", "vision3-250d-borrower", "cinestill", "400d", "color-negative" },
    orwo_chrom_ut21 = { "internal", "lab-only", "do-not-ship", "duplicate-borrower", "agfa-precisa-borrower", "orwo", "chrom", "ut21", "slide" },
    agfa_scala_200x = { "internal", "lab-only", "do-not-ship", "duplicate-borrower", "blocked-pending-fork", "black-and-white", "bw", "mono", "agfa", "scala", "200x", "trix-borrower" },
    ferrania_p30 = { "internal", "lab-only", "do-not-ship", "duplicate-borrower", "blocked-pending-fork", "black-and-white", "bw", "mono", "ferrania", "p30", "trix-borrower" },
    svema_type_42 = { "internal", "lab-only", "do-not-ship", "duplicate-borrower", "blocked-pending-fork", "black-and-white", "bw", "mono", "svema", "type-42", "foma-borrower" },
    tmax100_cc = { "internal", "lab-only", "do-not-ship", "creative-control", "black-and-white", "bw", "mono", "kodak", "t-max", "100", "cc" },
    ilford_hp5_cc = { "internal", "lab-only", "do-not-ship", "creative-control", "black-and-white", "bw", "mono", "ilford", "hp5-plus", "400", "cc" },
    delta_3200_cc = { "internal", "lab-only", "do-not-ship", "creative-control", "black-and-white", "bw", "mono", "ilford", "delta", "3200", "cc" },
    colorplus_200 = { "kodak", "consumer-kodak", "colorplus", "c-41", "daylight", "travel", "family", "snapshot", "warm", "35mm", "creative" },
    kodak_color_plus_200_cc = { "kodak", "consumer-kodak", "colorplus", "c-41", "daylight", "travel", "family", "snapshot", "warm", "35mm", "creative" },
    ultramax_400 = { "kodak", "ultramax", "c-41", "consumer-kodak", "snapshot", "daylight", "travel", "family", "everyday", "400", "creative" },
    ektar_100 = { "kodak", "ektar", "c-41", "vivid", "travel", "landscape", "product", "daylight", "color-negative", "creative", "100" },
    ektar_100_cc = { "kodak", "ektar", "c-41", "vivid", "travel", "landscape", "product", "daylight", "color-negative", "creative", "100" },
    ektachrome = { "legacy-control", "internal", "lab-only", "do-not-ship", "superseded-by-accurate", "landscape", "slide", "daylight" },
    ektachrome_cc = { "internal", "lab-only", "do-not-ship", "creative-variant", "legacy-control", "superseded-by-accurate", "ektachrome", "e100", "chrome", "slide", "e-6" },
    fuji_velvia_50 = { "fujifilm", "velvia", "slide", "reversal", "e-6", "vivid", "landscape", "nature", "color", "50", "creative" },
    fuji_provia_100f = { "fujifilm", "provia", "slide", "reversal", "e-6", "neutral", "daylight", "travel", "landscape", "100f", "accurate" },
    ektachrome_accurate_prototype = { "kodak", "ektachrome", "e100", "slide", "reversal", "e-6", "daylight", "clean-color", "accurate" },
    kodachrome_64_accurate_prototype = { "kodak", "kodachrome", "slide", "reversal", "classic-color", "64", "accurate" },
    kodachrome_64 = { "legacy-control", "internal", "lab-only", "do-not-ship", "superseded-by-accurate", "kodak", "kodachrome", "slide", "64" },
    kodachrome_v3 = { "internal", "lab-only", "do-not-ship", "creative-variant", "legacy-control", "superseded-by-accurate", "kodachrome", "64", "classic-color", "slide" },
    fuji_provia_rx = { "fujifilm", "provia", "400x", "slide", "reversal", "e-6", "chrome", "high-speed-slide", "travel", "landscape", "creative" },
    agfa_precisa = { "agfaphoto", "precisa", "ct-precisa", "slide", "reversal", "e-6", "chrome", "daylight", "travel", "landscape", "100", "creative" },
    fuji_provia_cc = { "clean-chrome", "chrome", "daylight", "slide-style", "neutral", "crisp", "controlled-saturation", "creative-chrome", "creative-by-mindfullens" },
    vision3_50d = { "kodak", "vision3", "50d", "cinema-negative", "motion-picture", "daylight", "ecn-2", "low-iso", "clean-color", "creative" },
    vision3_250d = { "kodak", "vision3", "250d", "cinema-negative", "motion-picture", "daylight", "ecn-2", "editorial", "travel", "creative" },
    vision3_200t = { "kodak", "vision3", "200t", "cinema-negative", "motion-picture", "tungsten", "ecn-2", "interior", "cinema", "creative" },
    vision3_200t_plus = { "kodak", "vision3", "200t", "cinema-negative", "motion-picture", "tungsten", "ecn-2", "push", "interior", "cinema", "creative" },
    vision3_500t = { "ecn-2", "cinema-negative", "tungsten", "accurate", "night-interior", "high-iso", "5219" },
    cinestill_800t = { "noc", "neon", "tungsten", "night-city", "creative", "cinema-tungsten" },
    cinestill_800 = { "cinestill", "800", "c-41", "cinema-inspired", "night", "available-light", "creative", "high-iso", "film-negative", "color-negative" },
    cinestill_50d = { "cinestill", "50d", "c-41", "daylight", "cinema-inspired", "motion-picture", "creative", "low-iso", "clean-color", "film-negative", "color-negative" },
    blue_velvet_cinestill_50d = { "internal", "lab-only", "do-not-ship", "creative-branch", "cinema", "motion-picture", "experimental", "blocked-pending-product-decision", "blue-velvet", "cinestill-50d", "stylized" },
    bw_trix_400 = { "kodak", "tri-x", "black-and-white", "bw", "mono", "400", "documentary", "reportage", "street", "grain", "creative" },
    bw_trix_1600 = { "kodak", "tri-x", "black-and-white", "bw", "mono", "1600", "push", "documentary", "grain", "creative" },
    bw_hp5 = { "ilford", "hp5", "hp5-plus", "black-and-white", "bw", "mono", "400", "documentary", "street", "grain", "creative" },
    bw_tmax_400 = { "kodak", "t-max", "black-and-white", "bw", "mono", "400", "t-grain", "clean", "documentary", "creative" },
    bw_foma_100 = { "foma", "fomapan", "black-and-white", "bw", "mono", "100", "classic", "grain", "daylight", "creative" },
    bw_foma_400 = { "foma", "fomapan", "black-and-white", "bw", "mono", "400", "classic", "grain", "documentary", "creative" },
    bw_xp2 = { "ilford", "xp2", "black-and-white", "bw", "mono", "400", "c-41-bw", "smooth", "travel", "creative" },
    bw_arista_edu_100 = { "arista", "edu-ultra", "black-and-white", "bw", "mono", "400", "student-film", "classic", "grain", "creative" },
    bw_kosmo_pan = { "kosmo-foto", "mono", "black-and-white", "bw", "100", "retro", "classic", "street", "creative" },
    bw_delta_3200 = { "ilford", "delta", "black-and-white", "bw", "mono", "3200", "high-speed", "low-light", "grain", "creative" },
    bw_tmax_100 = { "kodak", "t-max", "black-and-white", "bw", "mono", "100", "fine-grain", "clean", "studio", "creative" },
    bw_delta_100 = { "ilford", "delta", "black-and-white", "bw", "mono", "100", "fine-grain", "clean", "portrait", "editorial", "creative" },
    rollei_ortho_25 = { "rollei", "ortho", "black-and-white", "bw", "mono", "25", "orthochromatic", "high-detail", "creative" },
    bw_vision = { "internal", "lab-only", "do-not-ship", "experimental", "blocked-pending-validation", "black-and-white", "bw", "mono", "kodak", "vision3", "cinema-mono", "experimental-branch" },
    acros_x = { "internal", "lab-only", "do-not-ship", "experimental", "blocked-pending-validation", "black-and-white", "bw", "mono", "fujifilm", "acros", "experimental-branch" },
    acros_xy = { "internal", "lab-only", "do-not-ship", "experimental", "blocked-pending-validation", "black-and-white", "bw", "mono", "fujifilm", "acros", "yellow-filter-sim" },
    acros_xr = { "internal", "lab-only", "do-not-ship", "experimental", "blocked-pending-validation", "black-and-white", "bw", "mono", "fujifilm", "acros", "red-filter-sim" },
    acros_xg = { "internal", "lab-only", "do-not-ship", "experimental", "blocked-pending-validation", "black-and-white", "bw", "mono", "fujifilm", "acros", "green-filter-sim" },
    classic_chrome = { "street", "document", "digital-sim" },
    sony_classic_negative = { "street", "document", "digital-sim" },
    classic_cinema = { "internal", "lab-only", "do-not-ship", "creative-branch", "cinema", "motion-picture", "experimental", "blocked-pending-product-decision", "classic-cinema", "generic-cinema" },
    fuji_eterna = { "fujifilm", "eterna", "cinema-negative", "motion-picture", "soft-color", "pastel", "cinema", "creative", "film-negative", "color-negative" },
    eastman_cn_ii_100 = { "eastman", "color-negative-ii", "cn-ii", "100", "cinema-negative", "motion-picture", "studio", "daylight", "creative", "film-negative", "color-negative" },
    sony_eterna = { "internal", "lab-only", "do-not-ship", "creative-branch", "cinema", "motion-picture", "experimental", "blocked-pending-product-decision", "sony", "eterna", "digital-simulation" },
    fuji_nostalgic_neg = { "vintage", "warm", "digital-sim" },
    sony_nostalgic_neg = { "vintage", "warm", "digital-sim" },
    cinestill_x = { "internal", "lab-only", "do-not-ship", "creative-branch", "cinema", "motion-picture", "experimental", "blocked-pending-product-decision", "cinestill", "experimental" },
    cinechrome = { "internal", "lab-only", "do-not-ship", "creative-branch", "cinema", "motion-picture", "experimental", "blocked-pending-product-decision", "cinechrome", "chrome", "creative" },
    polaroid_polachrome = { "internal", "lab-only", "do-not-ship", "duplicate-borrower", "classic-cinema-borrower", "blocked-pending-fork", "polaroid", "polachrome", "slide", "color-positive" },
    astia_cc = { "internal", "lab-only", "do-not-ship", "legacy-duplicate", "deprecated-public-row" },
    fortia_50_cc = { "internal", "lab-only", "do-not-ship", "legacy-duplicate", "deprecated-public-row" },
    provia_rx_cc = { "internal", "lab-only", "do-not-ship", "legacy-duplicate", "deprecated-public-row" },
    solara_100_cc = { "internal", "lab-only", "do-not-ship", "legacy-duplicate", "deprecated-public-row" },
    redscale_ultra_cc = { "internal", "lab-only", "do-not-ship", "legacy-duplicate", "deprecated-public-row" },
    kodachrome_25 = { "internal", "lab-only", "do-not-ship", "legacy-duplicate", "deprecated-public-row" },
    acidnom = { "internal", "lab-only", "do-not-ship", "blocked-pending-fork", "borrower-risk", "acidnom", "creative", "color-negative" },
    adox_color_implosion = { "internal", "lab-only", "do-not-ship", "blocked-pending-fork", "borrower-risk", "adox", "color-implosion", "acidnom-borrower", "creative" },
    lomochrome_metropolis = { "internal", "lab-only", "do-not-ship", "blocked-pending-fork", "borrower-risk", "lomochrome", "metropolis", "acidnom-borrower", "creative" },
    lomochrome_purple = { "internal", "lab-only", "do-not-ship", "blocked-pending-fork", "borrower-risk", "lomochrome", "purple", "acidnom-borrower", "creative" },
    agfa_portrait_xps_160 = { "internal", "lab-only", "do-not-ship", "blocked-pending-fork", "borrower-risk", "agfa", "portrait-xps", "portra-160-borrower", "creative" },
    agfa_rsx_ii_200 = { "internal", "lab-only", "do-not-ship", "blocked-pending-fork", "borrower-risk", "agfa", "rsx-ii", "ektachrome-borrower", "slide", "creative" },
    kodak_ektachrome_e100g = { "internal", "lab-only", "do-not-ship", "blocked-pending-fork", "borrower-risk", "kodak", "ektachrome", "e100g", "legacy", "ektachrome-borrower" },
    kodak_aerocolor_iv = { "internal", "lab-only", "do-not-ship", "blocked-pending-fork", "borrower-risk", "kodak", "aerocolor", "portra-400-borrower", "creative" },
    konica_impresa_50 = { "internal", "lab-only", "do-not-ship", "blocked-pending-fork", "borrower-risk", "konica", "impresa", "ektar-100-borrower", "creative" },
    fuji_fp100c = { "internal", "lab-only", "do-not-ship", "blocked-pending-fork", "borrower-risk", "fujifilm", "fp-100c", "instant", "provia-borrower", "creative" },
    fuji_instax = { "internal", "lab-only", "do-not-ship", "blocked-pending-fork", "borrower-risk", "fujifilm", "instax", "instant", "provia-borrower", "creative" },
    asteroid_city_kodak_vision_t200_v1 = { "internal", "lab-only", "do-not-ship", "creative-branch", "cinema", "motion-picture", "experimental", "blocked-pending-product-decision", "asteroid-city", "kodak-vision", "200t", "v1", "stylized" },
    asteroid_city_kodak_vision_t200_v2 = { "internal", "lab-only", "do-not-ship", "creative-branch", "cinema", "motion-picture", "experimental", "blocked-pending-product-decision", "asteroid-city", "kodak-vision", "200t", "v2", "stylized" },
    ayon_200 = { "warm", "stylized", "golden-hour" },
    redscale_ultra = { "experimental", "redscale", "warm" },
    midred_infra = { "experimental", "infrared", "special-effect" },
    rose_spectra = { "experimental", "special-effect", "romantic" },
    dreamneg = { "experimental", "soft", "blue-hour" },
    phenomena = { "experimental", "blue-hour", "atmospheric" },
    chroma_fade = { "vintage", "fade", "retro" },
    neo_max = { "vintage", "retro", "muted" },
    vespera = { "night", "city", "stylized" },
}

-- Phase 3T-LR9B / 3U-2 / 3V-3: optional per-emulsion customer copy.
local EMULSION_SHORT_DESCRIPTION_BY_ID = {
    cinestill_800t = "Creative tungsten night look with subtle neon chrome separation. MindfulLens [C] interpretation using foundation, LUT, and white balance.",
    cinestill_50d = "CineStill 50D-inspired daylight color negative look with clean low-ISO color, soft cinema character, and creative daylight mood. MindfulLens [C] interpretation.",
    cinestill_800 = "CineStill 800-inspired high-speed color negative look for night, available light, and creative cinema-style scenes. MindfulLens [C] interpretation.",
    fuji_eterna = "Fujifilm Eterna-inspired cinema negative look with soft color, gentle contrast, and restrained motion-picture mood. MindfulLens [C] interpretation.",
    eastman_cn_ii_100 = "Eastman Color Negative II 100-inspired cinema negative look with studio color, clean daylight structure, and classic motion-picture character. MindfulLens [C] interpretation.",
    vision3_500t = "Clean ECN-2 tungsten cinema negative for night interiors and controlled low-light storytelling. MindfulLens [A] accurate candidate using foundation, LUT, and white balance.",
    vision3_50d = "Kodak Vision3 50D-inspired daylight cinema negative look with clean low-ISO color, controlled contrast, and motion-picture daylight character. MindfulLens [C] interpretation.",
    vision3_250d = "Kodak Vision3 250D-inspired daylight cinema negative look with balanced color, soft highlight behavior, and editorial motion-picture character. MindfulLens [C] interpretation.",
    vision3_200t = "Kodak Vision3 200T-inspired tungsten cinema negative look for interiors, practical light, and controlled warm low-light scenes. MindfulLens [C] interpretation.",
    vision3_200t_plus = "Pushed Kodak Vision3 200T-inspired tungsten cinema look with stronger density, deeper mood, and low-light motion-picture character. MindfulLens [C] interpretation.",
    gold_200 = "Warm consumer Kodak C-41 negative for family, travel, and daylight lifestyle. MindfulLens [C] interpretation using foundation, LUT, and white balance.",
    colorplus_200 = "Consumer Kodak C-41 color negative with everyday warmth, simple contrast, and casual snapshot character. MindfulLens [C] interpretation.",
    konica_centuria_100 = "Konica Centuria 100 is a daylight C-41 color-negative profile with soft consumer color, gentle contrast, and nostalgic compact-camera warmth.",
    kodak_color_plus_200_cc = "Internal Lab creative-control branch for ColorPlus comparison and QA. Not a primary customer-facing stock.",
    ektar_100 = "Kodak Ektar 100-inspired vivid C-41 color profile for travel, landscape, product, and strong daylight color. MindfulLens [C] interpretation.",
    ektar_100_cc = "Internal Lab creative-control branch for Ektar comparison and QA. Not a primary customer-facing stock.",
    kodak_oktar = "Clean Color 100 is a clean commercial Kodak-inspired C-41 creative look with warm-neutral color, polished contrast, and low-clutter daylight rendering.",
    oktar = "Oktar is a punchy high-saturation creative color look with bold contrast and expressive Kodak-inspired color energy.",
    ultramax_400 = "Kodak UltraMax 400-inspired everyday consumer C-41 look with stronger snapshot color and casual daylight warmth. MindfulLens [C] interpretation.",
    portra_160 = "Internal legacy/control track. Customer-facing canonical profile is Kodak Portra 160 [A] (portra_160_accurate_prototype). Do not expose to customer installers.",
    portra_400 = "Internal legacy/control track. Customer-facing canonical profile is Kodak Portra 400 [A] (portra_400_accurate_prototype). Do not expose to customer installers.",
    portra_800 = "Internal legacy/control track. Customer-facing canonical profile is Kodak Portra 800 [A] (portra_800_accurate_prototype). Do not expose to customer installers.",
    kodak_gold_v1 = "Internal creative print variant. Customer-facing canonical profile is Kodak Gold 200 [C]. Do not expose as a primary customer film stock.",
    kodak_gold_v2 = "Internal creative print variant. Customer-facing canonical profile is Kodak Gold 200 [C]. Do not expose as a primary customer film stock.",
    kodak_pro_image_100 = "Clean Kodak daylight C-41 profile tuned for natural skin, controlled warmth, and practical professional color.",
    portra_400_skinsafe_prototype = "Kodak Portra 400 Skin-Safe is an optional portrait and fine-art branch tuned for softer skin behavior, reduced redness, and gentle highlight handling.",
    fuji_400h = "Internal legacy/control Fuji Pro 400H branch. Customer-facing canonical profile is Fujifilm Pro 400H [A]. Do not expose to customer installers.",
    ektachrome = "Internal creative/base Ektachrome branch. Customer-facing canonical accurate profile is Kodak Ektachrome E100 [A]. Do not expose as primary customer Ektachrome.",
    ektachrome_cc = "Internal creative Ektachrome chrome variant. Customer-facing canonical profile is Kodak Ektachrome E100 [A]. Do not expose to customer installers.",
    kodachrome_64 = "Internal legacy Kodachrome 64 branch. Customer-facing canonical accurate profile is Kodak Kodachrome 64 [A]. Do not expose to customer installers.",
    kodachrome_v3 = "Internal creative/legacy Kodachrome 64 branch. Customer-facing canonical profile is Kodak Kodachrome 64 [A]. Do not expose to customer installers.",
    fuji_400h_cc = "Pastel Archive 400 is a soft high-key creative color profile with airy skin, pale greens, and luminous editorial contrast.",
    fuji_provia_100f = "Clean Fujifilm slide-film look with neutral daylight color, crisp contrast, and controlled saturation. MindfulLens [A] interpretation.",
    fuji_provia_cc = "Clean Chrome 100 is a neutral daylight chrome-inspired creative profile with clear color, crisp contrast, and controlled saturation.",
    fuji_velvia_50 = "Vivid Fujifilm slide-film look for strong landscape color, nature scenes, and saturated daylight. MindfulLens [C] interpretation.",
    ektachrome_accurate_prototype = "Clean Kodak Ektachrome E100 slide-film look with daylight clarity, controlled contrast, and crisp color. MindfulLens [A] interpretation.",
    kodachrome_64_accurate_prototype = "Classic Kodak Kodachrome 64-inspired slide-film look with disciplined contrast, nostalgic color separation, and clean daylight structure. MindfulLens [A] interpretation.",
    fuji_superia_400 = "Consumer Fuji C-41 color negative look with casual daylight color, street/travel energy, and approachable 400-speed character. MindfulLens [C] interpretation.",
    fuji_natura_1600 = "High-ISO Fuji-inspired color negative look for available light, night streets, and casual low-light scenes. MindfulLens [C] interpretation.",
    fuji_superia_1600 = "High-speed Superia-inspired consumer C-41 look for night, travel, and available-light snapshots. MindfulLens [C] interpretation.",
    fuji_astia_100f = "Soft Fujifilm slide-inspired look with gentle color, portrait-friendly contrast, and refined daylight rendering. MindfulLens [C] interpretation.",
    agfa_precisa = "AgfaPhoto CT Precisa 100-inspired chrome look with clean daylight color, travel contrast, and slide-style clarity. MindfulLens [C] interpretation.",
    fuji_provia_rx = "High-speed Provia-inspired slide look with crisp chrome contrast and stronger 400-speed daylight character. MindfulLens [C] interpretation.",
    fuji_fortia_50 = "Vivid Fujifilm Fortia 50-inspired slide look with strong color density, landscape contrast, and expressive chrome saturation. MindfulLens [C] interpretation.",
    fuji_reala_500d = "Professional Fuji C-41 daylight negative profile with neutral skin, controlled greens, and clean natural color.",
    astia_cc = "Internal legacy duplicate retained for compatibility/audit only; not available in customer installers.",
    fortia_50_cc = "Internal legacy duplicate retained for compatibility/audit only; not available in customer installers.",
    provia_rx_cc = "Internal legacy duplicate retained for compatibility/audit only; not available in customer installers.",
    solara_100_cc = "Internal legacy duplicate retained for compatibility/audit only; not available in customer installers.",
    redscale_ultra_cc = "Internal legacy duplicate retained for compatibility/audit only; not available in customer installers.",
    kodachrome_25 = "Internal legacy duplicate retained for compatibility/audit only; not available in customer installers.",
    acidnom = "Internal Lab profile retained for fork investigation; not available in customer installers.",
    adox_color_implosion = "Internal Lab profile retained for fork investigation; not available in customer installers.",
    lomochrome_metropolis = "Internal Lab profile retained for fork investigation; not available in customer installers.",
    lomochrome_purple = "Internal Lab profile retained for fork investigation; not available in customer installers.",
    agfa_portrait_xps_160 = "Internal Lab profile retained for fork investigation; not available in customer installers.",
    agfa_rsx_ii_200 = "Internal Lab profile retained for fork investigation; not available in customer installers.",
    kodak_ektachrome_e100g = "Internal Lab profile retained for fork investigation; not available in customer installers.",
    kodak_aerocolor_iv = "Internal Lab profile retained for fork investigation; not available in customer installers.",
    konica_impresa_50 = "Internal Lab profile retained for fork investigation; not available in customer installers.",
    fuji_fp100c = "Internal Lab profile retained for fork investigation; not available in customer installers.",
    fuji_instax = "Internal Lab profile retained for fork investigation; not available in customer installers.",
    cinestill_400d = "Internal CineStill 400D borrower branch. Not customer-ready; pending distinct stack and visual identity.",
    orwo_chrom_ut21 = "Internal ORWO Chrom UT21 duplicate borrower. Customer-facing chrome profile is AgfaPhoto CT Precisa 100 [C].",
    agfa_scala_200x = "Internal Agfa Scala 200x duplicate borrower. Not customer-ready; pending distinct B&W stack validation.",
    ferrania_p30 = "Internal Ferrania P30 duplicate borrower. Not customer-ready; pending distinct B&W stack validation.",
    svema_type_42 = "Internal Svema Type 42 duplicate borrower. Not customer-ready; pending distinct B&W stack validation.",
    tmax100_cc = "Internal Kodak T-Max 100 creative control branch. Customer-facing canonical profile is Kodak T-Max 100 [C].",
    ilford_hp5_cc = "Internal Ilford HP5 Plus 400 creative control branch. Customer-facing canonical profile is Ilford HP5 Plus 400 [C].",
    delta_3200_cc = "Internal Ilford Delta 3200 creative control branch. Customer-facing canonical profile is Ilford Delta 3200 [C].",
    bw_vision = "Internal Kodak Vision3 B&W experimental branch. Not customer-ready; pending visual validation and stock-identity decision.",
    acros_x = "Internal Fujifilm Acros experimental branch. Not customer-ready; pending Acros stock-identity validation.",
    acros_xy = "Internal Fujifilm Acros yellow-filter simulation branch. Not customer-ready.",
    acros_xr = "Internal Fujifilm Acros red-filter simulation branch. Not customer-ready.",
    acros_xg = "Internal Fujifilm Acros green-filter simulation branch. Not customer-ready.",
    sony_eterna = "Internal Sony Eterna digital-simulation branch. Not a public film stock profile.",
    classic_cinema = "Internal Classic Cinema creative branch. Not a public film stock profile.",
    cinestill_x = "Internal CineStill X experimental branch. Not a public CineStill stock profile.",
    blue_velvet_cinestill_50d = "Internal Blue Velvet CineStill 50D creative branch. Not a public film stock profile.",
    asteroid_city_kodak_vision_t200_v1 = "Internal Asteroid City Kodak Vision T200 V1 creative branch. Not a public film stock profile.",
    asteroid_city_kodak_vision_t200_v2 = "Internal Asteroid City Kodak Vision T200 V2 creative branch. Not a public film stock profile.",
    cinechrome = "Internal CineChrome creative branch. Not a public film stock profile.",
    polaroid_polachrome = "Internal Polaroid PolaChrome duplicate borrower. Not customer-ready; pending distinct stack and visual validation.",
    bw_hp5 = "Classic Ilford HP5 Plus 400-inspired black and white look with documentary grain, flexible contrast, and street/reportage character. MindfulLens [C] interpretation.",
    bw_delta_100 = "Clean Ilford Delta 100-inspired black and white look with fine grain, smooth tones, and refined daylight structure. MindfulLens [C] interpretation.",
    bw_trix_400 = "Kodak Tri-X 400-inspired black and white look with documentary contrast, expressive grain, and classic reportage energy. MindfulLens [C] interpretation.",
    bw_tmax_400 = "Kodak T-Max 400-inspired black and white look with cleaner T-grain structure, controlled contrast, and modern monochrome clarity. MindfulLens [C] interpretation.",
    bw_foma_100 = "Fomapan 100-inspired classic black and white look with traditional contrast, visible grain, and simple daylight character. MindfulLens [C] interpretation.",
    bw_foma_400 = "Fomapan 400-inspired black and white look with stronger grain, classic contrast, and documentary character. MindfulLens [C] interpretation.",
    bw_tmax_100 = "Kodak T-Max 100-inspired black and white look with fine grain, clean contrast, and precise daylight/studio tonality. MindfulLens [C] interpretation.",
    bw_delta_3200 = "Ilford Delta 3200-inspired high-speed black and white look with strong grain, low-light energy, and expressive contrast. MindfulLens [C] interpretation.",
    bw_xp2 = "Ilford XP2 Super 400-inspired chromogenic black and white look with smoother tones, softer grain, and flexible everyday contrast. MindfulLens [C] interpretation.",
    bw_trix_1600 = "Pushed Kodak Tri-X-inspired black and white look with stronger contrast, grain, and documentary intensity. MindfulLens [C] interpretation.",
    rollei_ortho_25 = "Rollei Ortho 25-inspired black and white look with high detail, crisp contrast, and orthochromatic tonal behavior. MindfulLens [C] interpretation.",
    bw_arista_edu_100 = "Arista EDU Ultra 400-inspired black and white look with classic student-film contrast, visible grain, and flexible everyday character. MindfulLens [C] interpretation.",
    bw_kosmo_pan = "Kosmo Foto Mono 100-inspired black and white look with retro contrast, classic grain, and street-friendly monochrome mood. MindfulLens [C] interpretation.",
}

local EMULSION_LONG_DESCRIPTION_BY_ID = {
    cinestill_800t = "Creative CineStill-inspired night profile with softer clarity and restrained neon separation versus Kodak Vision3 500T [A]. Built as an XMP + LUT + WB release candidate. DCP mode is disabled; glow/halation-like mood is achieved through grading and LUT behavior, not optical halation simulation.",
    cinestill_50d = "CineStill 50D-inspired daylight profile built as a creative C-41 cinema-style interpretation for bright light, travel, lifestyle, editorial, and clean outdoor color. Classified as [C] until a dedicated accurate validation exists.",
    cinestill_800 = "CineStill 800-inspired creative color negative profile for night streets, available light, interiors, and cinematic high-ISO scenes. Classified as [C] until a dedicated accurate validation exists. Separate from CineStill 800T [C], which remains the tungsten/night profile.",
    fuji_eterna = "Fujifilm Eterna-inspired creative cinema negative profile with softer contrast, muted color, and a pastel motion-picture character. The repo does not identify a specific Eterna ISO variant, so this profile is labeled at the Eterna family level and classified as [C].",
    eastman_cn_ii_100 = "Eastman Color Negative II 100-inspired creative cinema negative profile for studio, daylight, editorial, and motion-picture style scenes. Classified as [C] because no accurate validation is closed; future [A] promotion would require G4 foundation split and visual audit.",
    vision3_500t = "Accurate Kodak Vision3 500T / 5219 rendering with balanced separation, controlled highlights, and clean tungsten color response. Designed as the cinematic ECN-2 control beside CineStill 800T [C]: less stylized, less neon, and more disciplined in shadows and practical lights. Frozen PASS CANDIDATE v4.",
    vision3_50d = "Kodak Vision3 50D-inspired motion-picture negative profile for bright daylight, clean color, travel, editorial, and cinematic outdoor scenes. Classified as [C] until a dedicated accurate validation exists.",
    vision3_250d = "Kodak Vision3 250D-inspired motion-picture negative profile for daylight, travel, editorial, lifestyle, and cinematic outdoor scenes. Built as a creative [C] interpretation using the existing foundation/LUT/WB pipeline.",
    vision3_200t = "Kodak Vision3 200T-inspired tungsten motion-picture negative profile for interiors, practical light, studio scenes, and cinematic warm low-light rendering. Classified as [C] until a dedicated accurate validation exists.",
    vision3_200t_plus = "Kodak Vision3 200T+ inspired creative tungsten profile with a pushed cinema-negative feel, stronger density, and more dramatic low-light mood than the standard 200T branch. Classified as [C] until separate accurate validation exists.",
    gold_200 = "Kodak Gold 200 [C] consumer warm look with golden yellows, soft contrast, and nostalgic print character for family portraits, summer travel, and casual daylight scenes. Warmer and more golden than ColorPlus or UltraMax; softer than Ektar; less professional-neutral than Portra [A]. Frozen PASS CANDIDATE / PUBLIC RC on foundation gold_200_foundation.xmp. Release mode is XMP + LUT + WB only; DCP Mode B deferred.",
    colorplus_200 = "Kodak ColorPlus 200-inspired consumer negative profile with a simpler, more everyday color response than Gold 200 and less professional restraint than Portra. Built for casual daylight, travel, family, and snapshot-style scenes. MindfulLens [C] interpretation using the existing foundation/LUT/WB pipeline.",
    konica_centuria_100 = "Konica Centuria 100 is tuned as a soft daylight consumer C-41 negative profile with gentle contrast, restrained saturation, nostalgic warmth, and a compact-camera color feel. It is positioned separately from Kodak Gold 200 and no longer uses the Gold borrower stack in customer installers.",
    kodak_color_plus_200_cc = "Serwisowe internal ColorPlus 200 creative-control branch used for QA and A/B comparison. This row is not the canonical customer-facing Kodak ColorPlus 200 [C] release profile.",
    ektar_100 = "Kodak Ektar 100-inspired creative color negative profile with vivid reds, blues, and clean daylight punch. Positioned as a colorful travel and landscape interpretation, not a frozen accurate [A] reference. MindfulLens [C] interpretation using the existing foundation, LUT, and white balance pipeline.",
    ektar_100_cc = "Serwisowe internal Ektar 100 creative-control branch used for QA and A/B comparison. This row is not the canonical customer-facing Kodak Ektar 100 [C] release profile.",
    kodak_oktar = "Clean Color 100 is positioned as a clean commercial Kodak-inspired color-negative creative profile. It is designed for warm-neutral skin, polished daylight contrast, and a low-clutter professional look. It is intentionally quieter and cleaner than Oktar, and it is not a replacement for Kodak Ektar 100 [C] or any accurate stock profile.",
    oktar = "Oktar is a vivid Creative by MindfulLens profile designed for stronger color energy, punchier contrast, and a more expressive Kodak-inspired look. It sits apart from Clean Color 100, which is cleaner and more commercial, and from Kodak Ektar 100 [C], which remains the normalized stock profile.",
    ultramax_400 = "Kodak UltraMax 400-inspired consumer color negative profile for everyday daylight, travel, family, and casual snapshot scenes. More energetic than ColorPlus 200 and less golden than Kodak Gold 200. Classified as [C] until a dedicated accurate validation exists.",
    portra_160 = "Serwisowe Lab legacy garnitur for A/B comparison against frozen Kodak Portra 160 [A] accurate prototype. Hidden from customer ENG/PL installers (Phase 3W-8A). Not a stock-name public SKU.",
    portra_400 = "Serwisowe Lab legacy A/B base track. Shares DCP/LUT assets with Skin-Safe prototype family. Canonical customer Portra 400 is portra_400_accurate_prototype [A]. Hidden from customer installers (3W-8A).",
    portra_800 = "Serwisowe Lab legacy night-city garnitur. Canonical customer Portra 800 is portra_800_accurate_prototype [A]. Hidden from customer installers (3W-8A).",
    kodak_gold_v1 = "Pre-3V creative print branch with separate foundation from frozen Kodak Gold 200 [C]. Serwisowe Lab only — customer installers use gold_200 (3W-8A hide).",
    kodak_gold_v2 = "Pre-3V creative print branch with separate foundation from frozen Kodak Gold 200 [C]. Serwisowe Lab only — customer installers use gold_200 (3W-8A hide).",
    kodak_pro_image_100 = "Kodak Pro Image 100 [C] is a clean daylight C-41 color-negative profile designed for natural skin, practical portrait work, and balanced professional color. It sits between the casual warmth of Kodak Gold and the refined creaminess of Portra, with less vivid saturation than Ektar and a cleaner rendering than ColorPlus. MindfulLens [C] interpretation using the dedicated RC1 V1 foundation, LUT, and white balance pipeline. RC1 V1 stack approved after visual gate; formerly Gold borrower, now dedicated stack.",
    fuji_400h = "Serwisowe Lab legacy accurate v4 frozen track (3L-5). Dual-track with fuji_400h_accurate_prototype v3. Canonical customer profile is Fujifilm Pro 400H [A]. Hidden from customer ENG/PL installers (3W-11A).",
    ektachrome = "Serwisowe Lab Pop Travel creative base track. Shares ektachrome.cube with ektachrome_accurate_prototype. Canonical customer E100 slide is Kodak Ektachrome E100 [A]. Hidden from customer installers (3W-11A).",
    ektachrome_cc = "Serwisowe Lab-only creative Ektachrome branch for internal comparison and chrome-color experimentation. Customer-facing Ektachrome is the accurate Kodak Ektachrome E100 [A] profile. Not a primary public film stock. Hidden from customer installers (3W-11C).",
    kodachrome_64 = "Serwisowe Lab legacy garnitur. Shares kodachrome_64.cube with kodachrome_64_accurate_prototype. Canonical customer Kodachrome is Kodak Kodachrome 64 [A]. Hidden from customer installers (3W-11A).",
    kodachrome_v3 = "Serwisowe Lab-only Kodachrome creative/legacy branch used for internal comparison. It must not be labeled as the canonical Kodak Kodachrome 64 public profile; customer-facing Kodachrome is kodachrome_64_accurate_prototype. Hidden from customer installers (3W-11C).",
    fuji_400h_cc = "Pastel Archive 400 is a Creative by MindfulLens profile inspired by the soft high-key language of professional pastel color negative workflows. It is designed for airy portraits, pale greens, gentle skin, and luminous editorial work. It is not an Accurate stock profile and is intentionally separate from Fujifilm Pro 400H [A].",
    fuji_provia_100f = "Fujifilm Provia 100F-inspired reversal profile with balanced daylight color, crisp slide contrast, and restrained saturation compared with Velvia. Designed for travel, landscape, editorial, and clean daylight scenes. MindfulLens [A] interpretation.",
    fuji_provia_cc = "Clean Chrome 100 is a Creative by MindfulLens profile built for clean daylight slide-style color, crisp separation, and controlled saturation. It is not an Accurate stock profile and is intentionally separate from any Provia [A] or normalized chrome stock profile.",
    fuji_velvia_50 = "Fujifilm Velvia 50-inspired creative reversal profile with strong color density, vivid greens/blues, and classic landscape saturation. Classified as [C] until a dedicated accurate validation exists.",
    ektachrome_accurate_prototype = "Kodak Ektachrome E100-inspired accurate slide profile with clean daylight rendering, crisp contrast, and disciplined color response. Designed as the Kodak E-6 control beside creative chrome variants.",
    kodachrome_64_accurate_prototype = "Kodak Kodachrome 64-inspired accurate candidate for classic daylight slide rendering: structured contrast, restrained nostalgia, and recognizable Kodachrome color separation. Creative Kodachrome variants remain separate.",
    fuji_superia_400 = "Fujifilm Superia X-TRA 400-inspired consumer color negative profile for daylight, street, family, and travel scenes. More casual and snapshot-oriented than Fujifilm Pro 400H [A], with consumer Fuji color character and everyday 400-speed flexibility.",
    fuji_natura_1600 = "Fujifilm Natura 1600-inspired high-speed consumer color negative profile for low light, night streets, available light, and travel scenes. Built as a creative [C] interpretation with a distinct high-ISO Fuji mood, not a clean cinema tungsten profile.",
    fuji_superia_1600 = "Fujifilm Superia 1600-inspired high-ISO consumer negative profile with casual color, stronger speed character, and snapshot-style low-light flexibility. Positioned as a creative consumer Fuji branch, separate from Natura 1600 and cinema/night tungsten profiles.",
    fuji_astia_100f = "Fujifilm Astia 100F-inspired reversal profile with softer slide contrast, smoother color, and a more portrait-friendly character than stronger chrome stocks. Classified as [C] until a dedicated accurate validation exists.",
    agfa_precisa = "AgfaPhoto CT Precisa 100-inspired slide profile for daylight travel, landscape, and chrome color rendering. Built as a creative [C] interpretation using the current foundation/LUT/WB pipeline, not a frozen accurate reference.",
    fuji_provia_rx = "Fujifilm Provia 400X-inspired high-speed reversal profile with slide-style contrast, chrome color separation, and more energy than Provia 100F. Classified as [C] to avoid collision with the accurate Fujifilm Provia 100F [A] profile.",
    fuji_fortia_50 = "Fujifilm Fortia 50-inspired creative reversal profile with high color saturation, strong landscape energy, vivid greens/blues, and punchy daylight chrome character. Classified as [C] until a dedicated accurate validation exists.",
    fuji_reala_500d = "Fujifilm Reala 500D is a professional daylight C-41 color-negative profile tuned for natural skin, restrained Fuji greens, and clean organic color separation. It is designed to sit between consumer Superia energy and softer Pro 400H-style neutrality, without using the previous Vision3 250D borrower stack.",
    portra_400_skinsafe_prototype = "Kodak Portra 400 Skin-Safe is a specialized portrait and fine-art branch of the Portra 400 system. It is designed for softer skin rendering, reduced red/orange pressure, and a gentler portrait feel while preserving the Portra color-negative character. It is not a replacement for Kodak Portra 400 [A], which remains the canonical accurate stock profile.",
    astia_cc = "This profile is retained in Serwisowe as a legacy duplicate public row. Customer installers should use the canonical replacement profile instead. No visual stack changes were made in this phase.",
    fortia_50_cc = "This profile is retained in Serwisowe as a legacy duplicate public row. Customer installers should use the canonical replacement profile instead. No visual stack changes were made in this phase.",
    provia_rx_cc = "This profile is retained in Serwisowe as a legacy duplicate public row. Customer installers should use the canonical replacement profile instead. No visual stack changes were made in this phase.",
    solara_100_cc = "This profile is retained in Serwisowe as a legacy duplicate public row. Customer installers should use the canonical replacement profile instead. No visual stack changes were made in this phase.",
    redscale_ultra_cc = "This profile is retained in Serwisowe as a legacy duplicate public row. Customer installers should use the canonical replacement profile instead. No visual stack changes were made in this phase.",
    kodachrome_25 = "This profile is retained in Serwisowe as a legacy duplicate public row. Customer installers should use the canonical replacement profile instead. No visual stack changes were made in this phase.",
    acidnom = "This profile is retained in Serwisowe for analysis only. It shares or borrows a stack from another profile and requires a dedicated foundation/LUT/DCP path before any future public release.",
    adox_color_implosion = "This profile is retained in Serwisowe for analysis only. It shares or borrows a stack from another profile and requires a dedicated foundation/LUT/DCP path before any future public release.",
    lomochrome_metropolis = "This profile is retained in Serwisowe for analysis only. It shares or borrows a stack from another profile and requires a dedicated foundation/LUT/DCP path before any future public release.",
    lomochrome_purple = "This profile is retained in Serwisowe for analysis only. It shares or borrows a stack from another profile and requires a dedicated foundation/LUT/DCP path before any future public release.",
    agfa_portrait_xps_160 = "This profile is retained in Serwisowe for analysis only. It shares or borrows a stack from another profile and requires a dedicated foundation/LUT/DCP path before any future public release.",
    agfa_rsx_ii_200 = "This profile is retained in Serwisowe for analysis only. It shares or borrows a stack from another profile and requires a dedicated foundation/LUT/DCP path before any future public release.",
    kodak_ektachrome_e100g = "This profile is retained in Serwisowe for analysis only. It shares or borrows a stack from another profile and requires a dedicated foundation/LUT/DCP path before any future public release.",
    kodak_aerocolor_iv = "This profile is retained in Serwisowe for analysis only. It shares or borrows a stack from another profile and requires a dedicated foundation/LUT/DCP path before any future public release.",
    konica_impresa_50 = "This profile is retained in Serwisowe for analysis only. It shares or borrows a stack from another profile and requires a dedicated foundation/LUT/DCP path before any future public release.",
    fuji_fp100c = "This profile is retained in Serwisowe for analysis only. It shares or borrows a stack from another profile and requires a dedicated foundation/LUT/DCP path before any future public release.",
    fuji_instax = "This profile is retained in Serwisowe for analysis only. It shares or borrows a stack from another profile and requires a dedicated foundation/LUT/DCP path before any future public release.",
    cinestill_400d = "Serwisowe Lab-only CineStill 400D branch currently blocked from customer release because it borrows the Vision3 250D daylight cinema stack. Do not expose as a separate customer film stock unless a distinct CineStill 400D identity is created and validated later.",
    orwo_chrom_ut21 = "Serwisowe Lab-only ORWO Chrom UT21 branch currently blocked from customer release because it borrows the Agfa Precisa stack. Do not expose as a separate customer film stock unless a distinct ORWO identity is created and validated later.",
    agfa_scala_200x = "Serwisowe Lab-only Agfa Scala 200x branch currently blocked from customer release because it borrows the Kodak Tri-X 400 B&W stack. Do not expose as a separate customer film stock unless a distinct Scala identity is created and validated.",
    ferrania_p30 = "Serwisowe Lab-only Ferrania P30 branch currently blocked from customer release because it borrows the Kodak Tri-X 400 B&W stack. Do not expose as a separate customer film stock unless a distinct Ferrania P30 identity is created and validated.",
    svema_type_42 = "Serwisowe Lab-only Svema Type 42 branch currently blocked from customer release because it borrows the Fomapan 100 B&W stack. Do not expose as a separate customer film stock unless a distinct Svema identity is created and validated.",
    tmax100_cc = "Serwisowe Lab-only Kodak T-Max 100 creative/control branch used for internal A/B comparison. It shares the canonical T-Max 100 foundation family but uses distinct creative assets. Do not expose to customer installers unless separately validated.",
    ilford_hp5_cc = "Serwisowe Lab-only Ilford HP5 Plus 400 creative/control branch used for internal A/B comparison. It shares the canonical HP5 foundation family but uses distinct creative assets. Do not expose to customer installers unless separately validated.",
    delta_3200_cc = "Serwisowe Lab-only Ilford Delta 3200 creative/control branch used for internal A/B comparison. It shares the canonical Delta 3200 foundation family but uses distinct creative assets. Do not expose to customer installers unless separately validated.",
    acros_xg = "Serwisowe Lab-only Fujifilm Acros green-filter simulation branch. Not customer-ready.",
    sony_eterna = "Serwisowe Lab-only digital/cinema simulation branch. It must not be exposed as Fujifilm Eterna or a public film stock profile without separate product positioning and validation.",
    classic_cinema = "Serwisowe Lab-only generic cinema creative branch used for internal comparison and stylistic testing. Do not expose in the customer film-stock catalog.",
    cinestill_x = "Serwisowe Lab-only CineStill experimental branch. It must not be exposed as a public CineStill stock unless a real stock identity and visual validation are established.",
    blue_velvet_cinestill_50d = "Serwisowe Lab-only stylized CineStill 50D-derived creative branch. It belongs to internal cinematic look testing, not the customer film-stock catalog.",
    asteroid_city_kodak_vision_t200_v1 = "Serwisowe Lab-only stylized Kodak Vision T200 creative branch inspired by a cinematic look. It must not be exposed as an original film stock profile.",
    asteroid_city_kodak_vision_t200_v2 = "Serwisowe Lab-only alternate stylized Kodak Vision T200 creative branch inspired by a cinematic look. It must not be exposed as an original film stock profile.",
    cinechrome = "Serwisowe Lab-only creative chrome/cinema branch used for internal testing. It must not be exposed as an original film stock without separate product approval.",
    polaroid_polachrome = "Serwisowe Lab-only Polaroid PolaChrome branch currently blocked from customer release because it borrows the Classic Cinema foundation, LUT, and DCP. Do not expose as a separate customer film stock unless a distinct PolaChrome identity is created and validated later.",
    bw_vision = "Serwisowe Lab-only cinema-inspired monochrome branch. It must not be exposed as a public Kodak Vision or Double-X stock profile until a dedicated visual validation and stock-identity memo confirms the correct positioning.",
    acros_x = "Serwisowe Lab-only Acros experimental monochrome branch. It must not be exposed as Fujifilm Neopan Acros or Acros II without a dedicated stock-identity validation and public profile decision.",
    acros_xy = "Serwisowe Lab-only Acros yellow-filter simulation branch. This is a filter-simulation variant, not a standalone public Acros film stock profile.",
    acros_xr = "Serwisowe Lab-only Acros red-filter simulation branch. This is a filter-simulation variant, not a standalone public Acros film stock profile.",
    acros_xg = "Serwisowe Lab-only Acros green-filter simulation branch. This is a filter-simulation variant, not a standalone public Acros film stock profile.",
    bw_hp5 = "Ilford HP5 Plus 400-inspired monochrome profile with versatile midtone contrast, visible grain, and a documentary black and white character. Designed for street, reportage, portraits, and everyday available-light scenes. Classified as [C] until a dedicated accurate validation exists.",
    bw_delta_100 = "Ilford Delta 100-inspired monochrome profile with smoother tonal separation, finer grain, and a cleaner editorial black and white feel. Designed for portraits, daylight, still life, and refined monochrome work. Classified as [C] until accurate validation exists.",
    bw_trix_400 = "Kodak Tri-X 400-inspired monochrome profile built for street, documentary, reportage, and high-character black and white scenes. Stronger grain and punchier contrast give it a classic photographic feel. Classified as [C] until accurate validation exists.",
    bw_tmax_400 = "Kodak T-Max 400-inspired monochrome profile with cleaner grain behavior, disciplined contrast, and a more modern black and white response than classic reportage stocks. Classified as [C] until accurate validation exists.",
    bw_foma_100 = "Fomapan 100-inspired monochrome profile with classic film contrast, traditional grain, and a straightforward daylight black and white feel. Built as a creative [C] interpretation for simple, timeless monochrome scenes.",
    bw_foma_400 = "Fomapan 400-inspired monochrome profile with more pronounced grain, stronger classic contrast, and a documentary black and white mood. Built as a creative [C] interpretation for street, reportage, and available-light scenes.",
    bw_tmax_100 = "Kodak T-Max 100-inspired monochrome profile with fine-grain character, clean tonal structure, and a controlled modern black and white response. Built for daylight, studio, still life, and detailed monochrome scenes. Classified as [C] until accurate validation exists.",
    bw_delta_3200 = "Ilford Delta 3200-inspired monochrome profile built for low light, available light, documentary, and high-speed black and white scenes. Stronger grain and contrast create a distinct high-ISO film mood. Classified as [C] until accurate validation exists.",
    bw_xp2 = "Ilford XP2 Super 400-inspired C-41 black and white profile with smooth tonal transitions, restrained grain, and approachable contrast. Built for travel, documentary, portraits, and everyday monochrome scenes. Classified as [C] until accurate validation exists.",
    bw_trix_1600 = "Kodak Tri-X 1600-inspired pushed monochrome profile with higher contrast, pronounced grain, and a rougher reportage character than standard Tri-X 400. Classified as [C] until accurate validation exists.",
    rollei_ortho_25 = "Rollei Ortho 25-inspired monochrome profile with fine detail, crisp tonal separation, and an orthochromatic black and white character. Built for daylight, architecture, still life, and graphic monochrome scenes. Classified as [C] until accurate validation exists.",
    bw_arista_edu_100 = "Arista EDU Ultra 400-inspired monochrome profile with accessible classic contrast, visible grain, and an everyday black and white feel. Built as a creative interpretation for documentary, street, and learning-oriented film looks.",
    bw_kosmo_pan = "Kosmo Foto Mono 100-inspired monochrome profile with classic 100-speed contrast, retro tonal character, and a simple street/documentary black and white mood. Classified as [C] until accurate validation exists.",
}

local GRAIN_FAMILY_BY_ID = {}

mergeInto(GRAIN_FAMILY_BY_ID, listToMap({
    "gold_200",
    "colorplus_200",
    "ultramax_400",
    "vision3_250d",
    "vision3_200t",
    "vision3_200t_plus",
    "kodak_solara_100",
    "fuji_superia_400",
    "agfa_precisa",
    "gaf_500",
    "leicachrome",
    "sony_standard_cl",
    "sony_classic_negative",
    "kodak_gold_v1",
    "kodak_gold_v2",
    "kodachrome_v1",
    "kodachrome_v2",
    "kodachrome_v3",
    "classic_chrome",
    "pro_neg_std",
    "classic_cinema",
    "procolor",
    "neo_max",
    "asteroid_city_kodak_vision_t200_v1",
    "asteroid_city_kodak_vision_t200_v2",
    "fuji_400h_cc",
    "ektar_100_cc",
    "kodak_color_plus_200_cc",
    "ektachrome_cc",
    "provia_rx_cc",
    "astia_cc",
    "fortia_50_cc",
    "solara_100_cc",
    "agfa_portrait_xps_160",
    "konica_centuria_100",
}, "classic_35"))

mergeInto(GRAIN_FAMILY_BY_ID, listToMap({
    "portra_160",
    "portra_400",
    "portra_800",
    "fuji_400h",
    "fuji_400h_accurate_prototype",
    "fuji_reala_500d",
    "fuji_eterna",
    "sony_eterna",
    "cinechrome",
    "portra_400_skinsafe_prototype",
    "portra_160_accurate_prototype",
    "portra_400_accurate_prototype",
    "portra_800_accurate_prototype",
}, "medium_cream"))

mergeInto(GRAIN_FAMILY_BY_ID, listToMap({
    "bw_trix_400",
    "bw_trix_1600",
    "bw_xp2",
    "bw_tmax_400",
    "bw_foma_100",
    "bw_arista_edu_100",
    "bw_hp5",
    "bw_delta_3200",
    "bw_kosmo_pan",
    "bw_vision",
    "bw_foma_400",
    "acros_x",
    "acros_xy",
    "acros_xr",
    "acros_xg",
    "vision3_500t",
    "fuji_natura_1600",
    "fuji_superia_1600",
    "cinestill_800t",
    "cinestill_800",
    "cinestill_x",
    "crimson",
    "estra_500",
    "midred_infra",
    "tmax100_cc",
    "delta_3200_cc",
    "ilford_hp5_cc",
    "agfa_scala_200x",
    "svema_type_42",
}, "bw_push"))

mergeInto(GRAIN_FAMILY_BY_ID, listToMap({
    "harman_phoenix",
    "phoenix_harman",
    "acidnom",
    "magic_spice",
    "redscale_ultra",
    "redscale_ultra_cc",
    "chroma_fade",
    "lomochrome_metropolis",
    "lomochrome_purple",
    "fuji_fp100c",
    "fuji_instax",
    "orwo_chrom_ut21",
    "polaroid_polachrome",
    "adox_color_implosion",
}, "disposable_lofi"))

mergeInto(GRAIN_FAMILY_BY_ID, listToMap({
    "ektar_100",
    "kodak_pro_image_100",
    "ektachrome",
    "vision3_50d",
    "kodachrome_25",
    "kodachrome_64",
    "kodachrome_64_accurate_prototype",
    "kodak_oktar",
    "eastman_cn_ii_100",
    "bw_tmax_100",
    "bw_delta_100",
    "fuji_velvia_50",
    "fuji_astia_100f",
    "fuji_provia_100f",
    "fuji_provia_rx",
    "fuji_fortia_50",
    "fuji_nostalgic_neg",
    "cinestill_50d",
    "blue_velvet_cinestill_50d",
    "sony_nostalgic_neg",
    "vektro100",
    "senova_light",
    "evproplus",
    "velvia_pro",
    "oktar",
    "zero_mute",
    "dreamneg",
    "zetra_100",
    "rose_spectra",
    "ayon_200",
    "phenomena",
    "amarelo_30d",
    "vespera",
    "veniliqum",
    "gold_luxe",
    "x_tarr",
    "agfa_rsx_ii_200",
    "konica_impresa_50",
    "rollei_ortho_25",
    "ferrania_p30",
    "kodak_aerocolor_iv",
    "kodak_ektachrome_e100g",
    "cinestill_400d",
    "ektachrome_accurate_prototype",
}, "low_iso_smooth"))

local GRAIN_SPECS = {
    classic_35 = {
        amount = { 40, 50 },
        size = { 30, 40 },
        rough = { 48, 58 },
        weight = 0.74,
    },
    medium_cream = {
        amount = { 16, 24 },
        size = { 42, 50 },
        rough = { 26, 34 },
        weight = 0.78,
    },
    medium_portrait_35 = {
        amount = { 24, 32 },
        size = { 34, 42 },
        rough = { 34, 42 },
        weight = 0.76,
    },
    bw_push = {
        amount = { 52, 68 },
        size = { 50, 60 },
        rough = { 70, 80 },
        weight = 0.84,
    },
    disposable_lofi = {
        amount = { 60, 78 },
        size = { 15, 25 },
        rough = { 62, 76 },
        weight = 0.86,
    },
    low_iso_smooth = {
        amount = { 15, 26 },
        size = { 22, 34 },
        rough = { 42, 56 },
        weight = 0.74,
    },
}

local FORMAT_OFFSETS = {
    ["35mm"] = { amount = 1, size = 0, rough = 1 },
    ["mf_120"] = { amount = -1, size = 2, rough = -2 },
    ["lf_4x5"] = { amount = -3, size = 4, rough = -5 },
    ["lf_8x10"] = { amount = -4, size = 5, rough = -6 },
}

local SOURCE_SCALE_OFFSETS = {
    auto = { amount = 0, size = 0, rough = 0 },
    full_frame = { amount = 0, size = 0, rough = 0 },
    aps_c = { amount = 0, size = -1, rough = -1 },
    micro_four_thirds = { amount = -1, size = -2, rough = -2 },
    compact_small = { amount = -2, size = -3, rough = -3 },
    digital_mf = { amount = 1, size = 1, rough = -1 },
}

function M.getPublicLabel(emulsionId, fallbackLabel)
    return PUBLIC_LABELS[emulsionId] or PUBLIC_LABELS[tostring(emulsionId or ""):gsub("_cc$", "")] or fallbackLabel
end

function M.getClientFacingLabel(emulsionId, legacyLabel, fallbackLabel)
    local referenceLabel = tostring(fallbackLabel or legacyLabel or "")
    if referenceLabel == "" then
        return M.getPublicLabel(emulsionId, fallbackLabel)
    end
    local suffix = CLIENT_LABEL_SUFFIX_BY_ID[emulsionId]
        or ((ok and L and type(L.t) == "function")
            and L.t("MindfulLens Interpretation")
            or "MindfulLens Interpretation")
    return referenceLabel .. " | " .. suffix
end

function M.getCategoryOrder()
    return CATEGORY_ORDER
end

function M.getCategoryMeta(categoryId)
    return CATEGORY_META[tostring(categoryId or "")] or CATEGORY_META.experimental
end

function M.getCategoryId(emulsionId, emulsionType, isBw)
    local emId = tostring(emulsionId or ""):gsub("_cc$", "")
    local mapped = EMULSION_CATEGORY_BY_ID[emId]
    if mapped then
        return mapped
    end
    if isBw then
        return "documentary_street"
    end
    if tostring(emulsionType or "") == "color_positive" then
        return "landscape_travel"
    end
    return "experimental"
end

function M.getCategoryPrefix(categoryId)
    local meta = M.getCategoryMeta(categoryId)
    return tostring(meta.prefix or "")
end

function M.getCategoryCode(categoryId)
    local meta = M.getCategoryMeta(categoryId)
    return tostring(meta.code or "EXP")
end

function M.getCreativeCollectionOrder()
    return CREATIVE_COLLECTION_ORDER
end

function M.getCreativeCollectionMeta(collectionId)
    return CREATIVE_COLLECTION_META[tostring(collectionId or "")]
end

function M.getCreativeCollectionId(emulsionId)
    local emId = tostring(emulsionId or ""):gsub("_cc$", "")
    return EMULSION_CREATIVE_COLLECTION_BY_ID[emId]
end

function M.getCreativeCollectionCode(emulsionId)
    local collectionId = M.getCreativeCollectionId(emulsionId)
    if not collectionId then
        return nil
    end
    local meta = M.getCreativeCollectionMeta(collectionId)
    return meta and meta.collectionCode or nil
end

function M.isCreativeCollectionRoleDocFix(emulsionId)
    local emId = tostring(emulsionId or ""):gsub("_cc$", "")
    return EMULSION_CREATIVE_COLLECTION_ROLE_DOC_BY_ID[emId] == true
end

function M.getShortDescription(emulsionId)
    local emId = tostring(emulsionId or ""):gsub("_cc$", "")
    return EMULSION_SHORT_DESCRIPTION_BY_ID[emId] or ""
end

function M.getLongDescription(emulsionId)
    local emId = tostring(emulsionId or ""):gsub("_cc$", "")
    return EMULSION_LONG_DESCRIPTION_BY_ID[emId] or ""
end

function M.getTags(emulsionId, emulsionType, isBw)
    local emId = tostring(emulsionId or ""):gsub("_cc$", "")
    local tags = {}
    local seen = {}

    local function add(tag)
        local normalized = tostring(tag or "")
        if normalized ~= "" and not seen[normalized] then
            seen[normalized] = true
            tags[#tags + 1] = normalized
        end
    end

    for _, tag in ipairs(EMULSION_TAGS_BY_ID[emId] or {}) do
        add(tag)
    end
    add(M.getCategoryId(emId, emulsionType, isBw))
    local creativeCollectionId = M.getCreativeCollectionId(emId)
    if creativeCollectionId then
        add("creative-by-mindful-lens")
        add("creative-collection-" .. creativeCollectionId)
        local collectionMeta = M.getCreativeCollectionMeta(creativeCollectionId)
        if collectionMeta and collectionMeta.collectionCode then
            add(collectionMeta.collectionCode)
        end
    end
    if M.isCreativeCollectionRoleDocFix(emId) then
        add("ROLE_DOC_FIX_ONLY")
    end
    if isBw then
        add("bw")
    end
    if tostring(emulsionType or "") == "color_positive" then
        add("slide")
    end
    return tags
end

function M.getGrainFamily(emulsionId, emulsionType, formatId, isBw)
    local emId = tostring(emulsionId or ""):gsub("_cc$", "")
    local family = GRAIN_FAMILY_BY_ID[emId]
    if family == "medium_cream" and tostring(formatId or "") == "35mm" then
        return "medium_portrait_35"
    end
    if family then
        return family
    end
    if isBw then
        return "bw_push"
    end
    if tostring(emulsionType or "") == "color_positive" then
        return "low_iso_smooth"
    end
    return "classic_35"
end

function M.getGrainSpec(familyId)
    return GRAIN_SPECS[familyId] or GRAIN_SPECS.classic_35
end

function M.getFormatOffsets(formatId)
    return FORMAT_OFFSETS[tostring(formatId or "")] or { amount = 0, size = 0, rough = 0 }
end

function M.getSourceScaleOffsets(sourceScaleId)
    return SOURCE_SCALE_OFFSETS[tostring(sourceScaleId or "")] or SOURCE_SCALE_OFFSETS.auto
end


-- Customer visibility + commercial entitlement (Phase 4A / build 169).
local LrPathUtils = import "LrPathUtils"
local cachedEntitlementModule = false

local function getEntitlementModule()
    if cachedEntitlementModule == false then
        local pluginPath = (_PLUGIN and _PLUGIN.path) or ""
        if pluginPath ~= "" then
            local ok, mod = pcall(function()
                return dofile(LrPathUtils.child(pluginPath, "lib/Entitlement.lua"))
            end)
            cachedEntitlementModule = (ok and mod) or nil
        else
            cachedEntitlementModule = nil
        end
    end
    return cachedEntitlementModule
end

local INTERNAL_TAG_BLOCKLIST = {
    internal = true,
    ["lab-only"] = true,
    ["do-not-ship"] = true,
    ["legacy-control"] = true,
}

local function hasBlockedInternalTag(emulsionId)
    local tags = EMULSION_TAGS_BY_ID[tostring(emulsionId or "")]
    if type(tags) ~= "table" then
        return false
    end
    for _, tag in ipairs(tags) do
        if INTERNAL_TAG_BLOCKLIST[tostring(tag)] == true then
            return true
        end
    end
    return false
end

local function isLabPublicLabel(emulsionId)
    local id = tostring(emulsionId or "")
    local label = PUBLIC_LABELS[id]
    if type(label) ~= "string" or label == "" then
        return false
    end
    if label:find("%[LAB%]", 1, true) then
        return true
    end
    if label:find("Duplicate Borrower", 1, true)
        or label:find("Fork Required", 1, true)
        or label:find("Experimental Branch", 1, true)
        or label:find("Creative Branch", 1, true)
        or label:find("Legacy Duplicate", 1, true)
        or label:find("Creative Control", 1, true)
        or label:find("Blocked Borrower", 1, true)
    then
        return true
    end
    if CLIENT_LABEL_SUFFIX_BY_ID[id] == "Internal Lab Control" then
        return true
    end
    return false
end

function M.isCustomerVisible(emulsionId)
    local id = tostring(emulsionId or "")
    if id == "" or id == "__original__" then
        return true
    end
    if PUBLIC_LABELS[id] == nil then
        return false
    end
    if isLabPublicLabel(id) or hasBlockedInternalTag(id) then
        return false
    end
    return true
end

function M.isProfileEntitled(emulsionId)
    local id = tostring(emulsionId or "")
    if id == "" or id == "__original__" then
        return true
    end
    local entitlement = getEntitlementModule()
    if entitlement and type(entitlement.isProfileAllowed) == "function" then
        return entitlement.isProfileAllowed(id) == true
    end
    return false
end

function M.isEmulsionVisibleToCustomer(emulsionId)
    return M.isCustomerVisible(emulsionId) and M.isProfileEntitled(emulsionId)
end

function M.getEntitlementUpgradeBanner()
    local entitlement = getEntitlementModule()
    if entitlement and type(entitlement.getUpgradeBanner) == "function" then
        return entitlement.getUpgradeBanner()
    end
    return nil
end

function M.getLicenseTier()
    local entitlement = getEntitlementModule()
    if entitlement and type(entitlement.getLicenseTier) == "function" then
        return entitlement.getLicenseTier()
    end
    return "unknown"
end

return M
