// @generated by protobuf-ts 2.11.1
// @generated from protobuf file "turn.proto" (package "aegis", syntax proto3)
// tslint:disable
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
import { WireType } from "@protobuf-ts/runtime";
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
import type { IBinaryReader } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { Spawn } from "./spawn";
import { Location } from "./location";
/**
 * @generated from protobuf message aegis.Turn
 */
export interface Turn {
    /**
     * @generated from protobuf field: int32 agentId = 1
     */
    agentId: number;
    /**
     * @generated from protobuf field: int32 energy_level = 2
     */
    energyLevel: number;
    /**
     * @generated from protobuf field: int32 steps_taken = 3
     */
    stepsTaken: number;
    /**
     * @generated from protobuf field: aegis.Location loc = 4
     */
    loc?: Location;
    /**
     * @generated from protobuf field: repeated string commands = 5
     */
    commands: string[];
    /**
     * @generated from protobuf field: repeated aegis.Spawn spawns = 6
     */
    spawns: Spawn[];
}
// @generated message type with reflection information, may provide speed optimized methods
class Turn$Type extends MessageType<Turn> {
    constructor() {
        super("aegis.Turn", [
            { no: 1, name: "agentId", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
            { no: 2, name: "energy_level", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
            { no: 3, name: "steps_taken", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
            { no: 4, name: "loc", kind: "message", T: () => Location },
            { no: 5, name: "commands", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "spawns", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => Spawn }
        ]);
    }
    create(value?: PartialMessage<Turn>): Turn {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.agentId = 0;
        message.energyLevel = 0;
        message.stepsTaken = 0;
        message.commands = [];
        message.spawns = [];
        if (value !== undefined)
            reflectionMergePartial<Turn>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Turn): Turn {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* int32 agentId */ 1:
                    message.agentId = reader.int32();
                    break;
                case /* int32 energy_level */ 2:
                    message.energyLevel = reader.int32();
                    break;
                case /* int32 steps_taken */ 3:
                    message.stepsTaken = reader.int32();
                    break;
                case /* aegis.Location loc */ 4:
                    message.loc = Location.internalBinaryRead(reader, reader.uint32(), options, message.loc);
                    break;
                case /* repeated string commands */ 5:
                    message.commands.push(reader.string());
                    break;
                case /* repeated aegis.Spawn spawns */ 6:
                    message.spawns.push(Spawn.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: Turn, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* int32 agentId = 1; */
        if (message.agentId !== 0)
            writer.tag(1, WireType.Varint).int32(message.agentId);
        /* int32 energy_level = 2; */
        if (message.energyLevel !== 0)
            writer.tag(2, WireType.Varint).int32(message.energyLevel);
        /* int32 steps_taken = 3; */
        if (message.stepsTaken !== 0)
            writer.tag(3, WireType.Varint).int32(message.stepsTaken);
        /* aegis.Location loc = 4; */
        if (message.loc)
            Location.internalBinaryWrite(message.loc, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
        /* repeated string commands = 5; */
        for (let i = 0; i < message.commands.length; i++)
            writer.tag(5, WireType.LengthDelimited).string(message.commands[i]);
        /* repeated aegis.Spawn spawns = 6; */
        for (let i = 0; i < message.spawns.length; i++)
            Spawn.internalBinaryWrite(message.spawns[i], writer.tag(6, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message aegis.Turn
 */
export const Turn = new Turn$Type();
