package com.spaceshipproject;

import java.util.UUID;

/**
 * Représentation en mémoire d'un spaceship.
 * - id : identifiant unique en base
 * - ownerUuid : propriétaire (seul lui peut modifier)
 * - name : nom affiché sur la télécommande et dans les GUI
 * - sizeX/Y/Z : dimensions de la boîte du spaceship
 * - spawnX/Y/Z : point de spawn RELATIF à l'origine (téléportation sur le ship)
 * - schematicJson : palette + blocs (RLE) sérialisés en JSON
 * - settingsJson : paramètres modifiables par le joueur (JSON)
 */
public class Spaceship {

    private final long id;
    private final UUID ownerUuid;
    private String name;
    private int sizeX;
    private int sizeY;
    private int sizeZ;
    private int spawnX;
    private int spawnY;
    private int spawnZ;
    private String schematicJson;
    private String settingsJson;
    private int level;
    private int money;
    private int lastLoadedLevel;

    public Spaceship(long id, UUID ownerUuid, String name,
                     int sizeX, int sizeY, int sizeZ,
                     int spawnX, int spawnY, int spawnZ,
                     String schematicJson, String settingsJson,
                     int level, int money, int lastLoadedLevel) {
        this.id = id;
        this.ownerUuid = ownerUuid;
        this.name = name;
        this.sizeX = sizeX;
        this.sizeY = sizeY;
        this.sizeZ = sizeZ;
        this.spawnX = spawnX;
        this.spawnY = spawnY;
        this.spawnZ = spawnZ;
        this.schematicJson = schematicJson;
        this.settingsJson = settingsJson;
        this.level = level;
        this.money = money;
        this.lastLoadedLevel = lastLoadedLevel;
    }

    public long getId() { return id; }
    public UUID getOwnerUuid() { return ownerUuid; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public int getSizeX() { return sizeX; }
    public int getSizeY() { return sizeY; }
    public int getSizeZ() { return sizeZ; }
    public void setSize(int x, int y, int z) { this.sizeX = x; this.sizeY = y; this.sizeZ = z; }
    public int getSpawnX() { return spawnX; }
    public int getSpawnY() { return spawnY; }
    public int getSpawnZ() { return spawnZ; }
    public void setSpawn(int x, int y, int z) { this.spawnX = x; this.spawnY = y; this.spawnZ = z; }
    public String getSchematicJson() { return schematicJson; }
    public void setSchematicJson(String schematicJson) { this.schematicJson = schematicJson; }
    public String getSettingsJson() { return settingsJson; }
    public void setSettingsJson(String settingsJson) { this.settingsJson = settingsJson; }
    public int getLevel() { return level; }
    public void setLevel(int level) { this.level = level; }
    /** @deprecated La money est maintenant geree via Vault. Conserve uniquement pour compatibilite DB. */
    @Deprecated public int getMoney() { return money; }
    @Deprecated public void setMoney(int money) { this.money = money; }
    public int getLastLoadedLevel() { return lastLoadedLevel; }
    public void setLastLoadedLevel(int lastLoadedLevel) { this.lastLoadedLevel = lastLoadedLevel; }
}
