// @generated by protobuf-ts 2.11.1
// @generated from protobuf file "spawn.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 { Team } from "./team";
import { Location } from "./location";
/**
 * @generated from protobuf message aegis.Spawn
 */
export interface Spawn {
    /**
     * @generated from protobuf field: int32 agentId = 1
     */
    agentId: number;
    /**
     * @generated from protobuf field: aegis.Location loc = 2
     */
    loc?: Location;
    /**
     * @generated from protobuf field: aegis.Team team = 3
     */
    team: Team;
}
/**
 * @generated from protobuf message aegis.InitSpawn
 */
export interface InitSpawn {
    /**
     * @generated from protobuf field: aegis.Location loc = 1
     */
    loc?: Location;
    /**
     * @generated from protobuf field: int32 amount = 2
     */
    amount: number;
}
// @generated message type with reflection information, may provide speed optimized methods
class Spawn$Type extends MessageType<Spawn> {
    constructor() {
        super("aegis.Spawn", [
            { no: 1, name: "agentId", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
            { no: 2, name: "loc", kind: "message", T: () => Location },
            { no: 3, name: "team", kind: "enum", T: () => ["aegis.Team", Team] }
        ]);
    }
    create(value?: PartialMessage<Spawn>): Spawn {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.agentId = 0;
        message.team = 0;
        if (value !== undefined)
            reflectionMergePartial<Spawn>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Spawn): Spawn {
        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 /* aegis.Location loc */ 2:
                    message.loc = Location.internalBinaryRead(reader, reader.uint32(), options, message.loc);
                    break;
                case /* aegis.Team team */ 3:
                    message.team = reader.int32();
                    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: Spawn, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* int32 agentId = 1; */
        if (message.agentId !== 0)
            writer.tag(1, WireType.Varint).int32(message.agentId);
        /* aegis.Location loc = 2; */
        if (message.loc)
            Location.internalBinaryWrite(message.loc, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* aegis.Team team = 3; */
        if (message.team !== 0)
            writer.tag(3, WireType.Varint).int32(message.team);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message aegis.Spawn
 */
export const Spawn = new Spawn$Type();
// @generated message type with reflection information, may provide speed optimized methods
class InitSpawn$Type extends MessageType<InitSpawn> {
    constructor() {
        super("aegis.InitSpawn", [
            { no: 1, name: "loc", kind: "message", T: () => Location },
            { no: 2, name: "amount", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
        ]);
    }
    create(value?: PartialMessage<InitSpawn>): InitSpawn {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.amount = 0;
        if (value !== undefined)
            reflectionMergePartial<InitSpawn>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: InitSpawn): InitSpawn {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* aegis.Location loc */ 1:
                    message.loc = Location.internalBinaryRead(reader, reader.uint32(), options, message.loc);
                    break;
                case /* int32 amount */ 2:
                    message.amount = reader.int32();
                    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: InitSpawn, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* aegis.Location loc = 1; */
        if (message.loc)
            Location.internalBinaryWrite(message.loc, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* int32 amount = 2; */
        if (message.amount !== 0)
            writer.tag(2, WireType.Varint).int32(message.amount);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message aegis.InitSpawn
 */
export const InitSpawn = new InitSpawn$Type();
