// • ▌ ▄ ·.  ▄▄▄·  ▄▄ • ▪   ▄▄· ▄▄▄▄·  ▄▄▄·  ▐▄▄▄  ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀  █▪▀▀▀ ▀  ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀  ▀  ▀ ▀▀  █▪ ▀▀▀
//      Magicbane Emulator Project © 2013 - 2022
//                www.magicbane.com


package engine.objects;

import engine.gameManager.DbManager;

import java.sql.ResultSet;
import java.sql.SQLException;

public class Condemned {

    public static final int INDIVIDUAL = 2;
    public static final int GUILD = 4;
    public static final int NATION = 5;

    public int playerUID;
    public int buildingUUID;
    public int guildUID;
    public int friendType;
    public boolean active;

    /**
     * ResultSet Constructor
     */
    public Condemned(ResultSet rs) throws SQLException {
        this.playerUID = rs.getInt("playerUID");
        this.buildingUUID = rs.getInt("buildingUID");
        this.guildUID = rs.getInt("guildUID");
        this.friendType = rs.getInt("friendType");
        this.active = rs.getBoolean("active");
    }

    public Condemned(int playerUID, int buildingUUID, int guildUID, int friendType) {
        super();
        this.playerUID = playerUID;
        this.buildingUUID = buildingUUID;
        this.guildUID = guildUID;
        this.friendType = friendType;
        this.active = false;
    }

    public boolean setActive(boolean active) {

        if (!DbManager.BuildingQueries.updateActiveCondemn(this, active))
            return false;

        this.active = active;
        return true;
    }

}