// Generated by delombok at Tue Dec 16 19:35:15 UTC 2025
package net.md_5.bungee.protocol.packet;

import io.netty.buffer.ByteBuf;
import java.util.UUID;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.ProtocolConstants;

public class BossBar extends DefinedPacket {
    private UUID uuid;
    private int action;
    private BaseComponent title;
    private float health;
    private int color;
    private int division;
    private byte flags;

    public BossBar(UUID uuid, int action) {
        this.uuid = uuid;
        this.action = action;
    }

    @Override
    public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
        uuid = readUUID(buf);
        action = readVarInt(buf);
        switch (action) {
        // Add
        case 0: 
            title = readBaseComponent(buf, protocolVersion);
            health = buf.readFloat();
            color = readVarInt(buf);
            division = readVarInt(buf);
            flags = buf.readByte();
            break;
        // Health
        case 2: 
            health = buf.readFloat();
            break;
        // Title
        case 3: 
            title = readBaseComponent(buf, protocolVersion);
            break;
        // Style
        case 4: 
            color = readVarInt(buf);
            division = readVarInt(buf);
            break;
        // Flags
        case 5: 
            flags = buf.readByte();
            break;
        }
    }

    @Override
    public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
        writeUUID(uuid, buf);
        writeVarInt(action, buf);
        switch (action) {
        // Add
        case 0: 
            writeBaseComponent(title, buf, protocolVersion);
            buf.writeFloat(health);
            writeVarInt(color, buf);
            writeVarInt(division, buf);
            buf.writeByte(flags);
            break;
        // Health
        case 2: 
            buf.writeFloat(health);
            break;
        // Title
        case 3: 
            writeBaseComponent(title, buf, protocolVersion);
            break;
        // Style
        case 4: 
            writeVarInt(color, buf);
            writeVarInt(division, buf);
            break;
        // Flags
        case 5: 
            buf.writeByte(flags);
            break;
        }
    }

    @Override
    public void handle(AbstractPacketHandler handler) throws Exception {
        handler.handle(this);
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public UUID getUuid() {
        return this.uuid;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int getAction() {
        return this.action;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public BaseComponent getTitle() {
        return this.title;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public float getHealth() {
        return this.health;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int getColor() {
        return this.color;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int getDivision() {
        return this.division;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public byte getFlags() {
        return this.flags;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setUuid(final UUID uuid) {
        this.uuid = uuid;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setAction(final int action) {
        this.action = action;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setTitle(final BaseComponent title) {
        this.title = title;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setHealth(final float health) {
        this.health = health;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setColor(final int color) {
        this.color = color;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setDivision(final int division) {
        this.division = division;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setFlags(final byte flags) {
        this.flags = flags;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public java.lang.String toString() {
        return "BossBar(uuid=" + this.getUuid() + ", action=" + this.getAction() + ", title=" + this.getTitle() + ", health=" + this.getHealth() + ", color=" + this.getColor() + ", division=" + this.getDivision() + ", flags=" + this.getFlags() + ")";
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public BossBar() {
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public boolean equals(final java.lang.Object o) {
        if (o == this) return true;
        if (!(o instanceof BossBar)) return false;
        final BossBar other = (BossBar) o;
        if (!other.canEqual((java.lang.Object) this)) return false;
        if (this.getAction() != other.getAction()) return false;
        if (java.lang.Float.compare(this.getHealth(), other.getHealth()) != 0) return false;
        if (this.getColor() != other.getColor()) return false;
        if (this.getDivision() != other.getDivision()) return false;
        if (this.getFlags() != other.getFlags()) return false;
        final java.lang.Object this$uuid = this.getUuid();
        final java.lang.Object other$uuid = other.getUuid();
        if (this$uuid == null ? other$uuid != null : !this$uuid.equals(other$uuid)) return false;
        final java.lang.Object this$title = this.getTitle();
        final java.lang.Object other$title = other.getTitle();
        if (this$title == null ? other$title != null : !this$title.equals(other$title)) return false;
        return true;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    protected boolean canEqual(final java.lang.Object other) {
        return other instanceof BossBar;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        result = result * PRIME + this.getAction();
        result = result * PRIME + java.lang.Float.floatToIntBits(this.getHealth());
        result = result * PRIME + this.getColor();
        result = result * PRIME + this.getDivision();
        result = result * PRIME + this.getFlags();
        final java.lang.Object $uuid = this.getUuid();
        result = result * PRIME + ($uuid == null ? 43 : $uuid.hashCode());
        final java.lang.Object $title = this.getTitle();
        result = result * PRIME + ($title == null ? 43 : $title.hashCode());
        return result;
    }
}
