package com.tiedup.remake.entities.damsel.components;

import com.tiedup.remake.entities.EntityDamsel;
import net.minecraft.nbt.CompoundTag;

/**
 * Orchestrates NBT serialization/deserialization for all EntityDamsel components.
 * Provides a single entry point for save/load operations.
 *
 */
public class DamselDataSerializer {

    private final EntityDamsel entity;

    public DamselDataSerializer(EntityDamsel entity) {
        this.entity = entity;
    }

    /**
     * Save all component data to NBT.
     * Call this from EntityDamsel.addAdditionalSaveData().
     *
     * @param tag NBT compound tag to write to
     */
    public void save(CompoundTag tag) {
        entity.getAppearance().saveToTag(tag);

        // Bondage + Inventory are now saved by AbstractTiedUpNpc.addAdditionalSaveData()

        entity.getPersonalitySystem().saveToTag(tag);

        // Reward tracker (savior, rewards)
        entity.getRewardTracker().save(tag);
    }

    /**
     * Load all component data from NBT.
     * Call this from EntityDamsel.readAdditionalSaveData().
     *
     * @param tag NBT compound tag to read from
     */
    public void load(CompoundTag tag) {
        entity.getAppearance().loadFromTag(tag);

        // Bondage + Inventory are now loaded by AbstractTiedUpNpc.readAdditionalSaveData()

        entity.getPersonalitySystem().loadFromTag(tag);

        // Reward tracker (savior, rewards)
        entity.getRewardTracker().load(tag);
    }
}
