package com.tiedup.remake.entities.skins;

import com.tiedup.remake.entities.KidnapperVariant;

/**
 * Registry and manager for Slave Trader skin variants.
 *
 * Slave Traders are the bosses of camps who sell captives.
 * They wear fancy/noble outfits to distinguish them from regular kidnappers.
 */
public class TraderSkinManager {

    public static final SkinManagerCore<KidnapperVariant> CORE =
        new SkinManagerCore<>(
            "TraderSkinManager",
            "slave_trader",
            SkinDefinition::toKidnapperVariant,
            TraderSkinManager::loadHardcodedDefaults
        );

    /**
     * Initialize and register all trader variants.
     */
    public static void registerDefaults() {
        CORE.registerDefaults();
    }

    /**
     * Load hardcoded default trader skin variants.
     */
    private static void loadHardcodedDefaults() {
        // Generic numbered skins (trader_mob_1 to trader_mob_10) - use random names
        for (int i = 1; i <= 10; i++) {
            CORE.registerVariant(
                createTraderVariant("trader_mob_" + i, true, null)
            );
        }

        // Named skins (specific characters)
        CORE.registerVariant(
            createTraderVariant("trader_default", true, "Madame")
        );
        CORE.registerVariant(
            createTraderVariant("trader_noble", true, "Lady Noble")
        );

        // CORE.registerVariant(createTraderVariant("trader_merchant", true, "The Merchant"));
        // CORE.registerVariant(createTraderVariant("trader_queen", true, "Queen of Chains"));
    }

    /**
     * Create a trader variant with proper texture path.
     * Uses KidnapperVariant.createWithSubfolder() helper.
     *
     * @param textureName Texture file name without extension
     * @param hasSlimArms True if this variant uses slim arms
     * @param displayName Display name, or null for generic "Trader"
     * @return Trader variant
     */
    private static KidnapperVariant createTraderVariant(
        String textureName,
        boolean hasSlimArms,
        String displayName
    ) {
        return KidnapperVariant.createWithSubfolder(
            textureName,
            "trader",
            hasSlimArms,
            displayName != null ? displayName : "Trader",
            Gender.FEMALE
        );
    }
}
