// Generated by delombok at Tue Oct 21 21:24:10 UTC 2025
package net.md_5.bungee.protocol.packet;

import io.netty.buffer.ByteBuf;
import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.ProtocolConstants;

public class CookieResponse extends DefinedPacket {
    private String cookie;
    private byte[] data;

    @Override
    public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
        cookie = readString(buf);
        data = readNullable(read -> DefinedPacket.readArray(read, 5120), buf);
    }

    @Override
    public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
        writeString(cookie, buf);
        writeNullable(data, DefinedPacket::writeArray, buf);
    }

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

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public String getCookie() {
        return this.cookie;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public byte[] getData() {
        return this.data;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setCookie(final String cookie) {
        this.cookie = cookie;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setData(final byte[] data) {
        this.data = data;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public java.lang.String toString() {
        return "CookieResponse(cookie=" + this.getCookie() + ", data=" + java.util.Arrays.toString(this.getData()) + ")";
    }

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

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public CookieResponse(final String cookie, final byte[] data) {
        this.cookie = cookie;
        this.data = data;
    }

    @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 CookieResponse)) return false;
        final CookieResponse other = (CookieResponse) o;
        if (!other.canEqual((java.lang.Object) this)) return false;
        final java.lang.Object this$cookie = this.getCookie();
        final java.lang.Object other$cookie = other.getCookie();
        if (this$cookie == null ? other$cookie != null : !this$cookie.equals(other$cookie)) return false;
        if (!java.util.Arrays.equals(this.getData(), other.getData())) return false;
        return true;
    }

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

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final java.lang.Object $cookie = this.getCookie();
        result = result * PRIME + ($cookie == null ? 43 : $cookie.hashCode());
        result = result * PRIME + java.util.Arrays.hashCode(this.getData());
        return result;
    }
}
