package space.animefu.starfallhaven;

import java.util.*;

/** Platform-neutral data types for the colony simulation. */
public final class ColonySystems {
    private ColonySystems() {}

    public enum Trait { STAR_LISTENER, STEADY_HANDS, NIGHT_OWL, KINDLED_SPIRIT, IRON_WILL, QUICK_STUDY }
    public enum Skill { BUILD, GATHER, CRAFT, COMBAT, MEDIC, HAUL }
    public enum WorkType { EMERGENCY, REST, CONSTRUCT, HAUL, CRAFT, GATHER }
    public enum Need { NOURISHMENT, REST, COMFORT, SAFETY }
    public enum OrderType { NONE, MOVE, ATTACK }
    public enum ResourceType { WOOD, STONE, FOOD, CRYSTAL, COMPONENT }
    public enum StructureType { WALL, DOOR, BED, FABRICATOR }
    public enum Recipe { NUTRIENT_PACK, RESONANT_COMPONENT }

    public static final class Thought {
        public final String label;
        public float moodEffect;
        public float secondsLeft;
        public Thought(String label,float moodEffect,float secondsLeft){this.label=label;this.moodEffect=moodEffect;this.secondsLeft=secondsLeft;}
    }

    public static final class Injury {
        public final String label;
        public float severity;
        public float bleedPerSecond;
        public Injury(String label,float severity,float bleedPerSecond){this.label=label;this.severity=severity;this.bleedPerSecond=bleedPerSecond;}
    }

    public static final class Blueprint {
        public final long id;
        public final StructureType type;
        public final int x,y;
        public float workDone;
        public final float workRequired;
        public boolean complete;
        public Blueprint(long id,StructureType type,int x,int y,float workRequired){this.id=id;this.type=type;this.x=x;this.y=y;this.workRequired=workRequired;}
    }

    public static final class Bed {
        public final long id;
        public final int x,y;
        public String ownerId;
        public Bed(long id,int x,int y){this.id=id;this.x=x;this.y=y;}
    }

    public static final class StockpileZone {
        public final long id;
        public final int x,y,width,height;
        public final EnumSet<ResourceType> allowed;
        public StockpileZone(long id,int x,int y,int width,int height,EnumSet<ResourceType> allowed){
            this.id=id;this.x=x;this.y=y;this.width=width;this.height=height;
            this.allowed=allowed==null||allowed.isEmpty()?EnumSet.noneOf(ResourceType.class):EnumSet.copyOf(allowed);
        }
        public boolean contains(float px,float py){return px>=x&&py>=y&&px<x+width&&py<y+height;}
        public boolean accepts(ResourceType type){return allowed.contains(type);}
    }

    public static final class ResourcePile {
        public final long id;
        public final ResourceType type;
        public int amount;
        public float x,y;
        public boolean stored;
        public String reservedBy;
        public ResourcePile(long id,ResourceType type,int amount,float x,float y){this.id=id;this.type=type;this.amount=amount;this.x=x;this.y=y;}
    }

    public static final class ProductionJob {
        public final long id,benchId;
        public final Recipe recipe;
        public int remaining;
        public float workDone;
        public ProductionJob(long id,long benchId,Recipe recipe,int remaining){this.id=id;this.benchId=benchId;this.recipe=recipe;this.remaining=remaining;}
    }

    public static final class RoomStats {
        public final boolean enclosed;
        public final int area,beds;
        public final float comfort;
        public RoomStats(boolean enclosed,int area,int beds,float comfort){this.enclosed=enclosed;this.area=area;this.beds=beds;this.comfort=comfort;}
    }
}
