// @generated by protobuf-ts 2.11.1 with parameter add_pb_suffix
// @generated from protobuf file "cosmos/group/v1/genesis.proto" (package "cosmos.group.v1", 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 { Vote } from "./types_pb";
import { Proposal } from "./types_pb";
import { GroupPolicyInfo } from "./types_pb";
import { GroupMember } from "./types_pb";
import { GroupInfo } from "./types_pb";
/**
 * GenesisState defines the group module's genesis state.
 *
 * @generated from protobuf message cosmos.group.v1.GenesisState
 */
export interface GenesisState {
    /**
     * group_seq is the group table sequence,
     * it is used to get the next group ID.
     *
     * @generated from protobuf field: uint64 group_seq = 1
     */
    groupSeq: bigint;
    /**
     * groups is the list of groups info.
     *
     * @generated from protobuf field: repeated cosmos.group.v1.GroupInfo groups = 2
     */
    groups: GroupInfo[];
    /**
     * group_members is the list of groups members.
     *
     * @generated from protobuf field: repeated cosmos.group.v1.GroupMember group_members = 3
     */
    groupMembers: GroupMember[];
    /**
     * group_policy_seq is the group policy table sequence,
     * it is used to generate the next group policy account address.
     *
     * @generated from protobuf field: uint64 group_policy_seq = 4
     */
    groupPolicySeq: bigint;
    /**
     * group_policies is the list of group policies info.
     *
     * @generated from protobuf field: repeated cosmos.group.v1.GroupPolicyInfo group_policies = 5
     */
    groupPolicies: GroupPolicyInfo[];
    /**
     * proposal_seq is the proposal table sequence,
     * it is used to get the next proposal ID.
     *
     * @generated from protobuf field: uint64 proposal_seq = 6
     */
    proposalSeq: bigint;
    /**
     * proposals is the list of proposals.
     *
     * @generated from protobuf field: repeated cosmos.group.v1.Proposal proposals = 7
     */
    proposals: Proposal[];
    /**
     * votes is the list of votes.
     *
     * @generated from protobuf field: repeated cosmos.group.v1.Vote votes = 8
     */
    votes: Vote[];
}
// @generated message type with reflection information, may provide speed optimized methods
class GenesisState$Type extends MessageType<GenesisState> {
    constructor() {
        super("cosmos.group.v1.GenesisState", [
            { no: 1, name: "group_seq", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 2, name: "groups", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => GroupInfo },
            { no: 3, name: "group_members", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => GroupMember },
            { no: 4, name: "group_policy_seq", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 5, name: "group_policies", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => GroupPolicyInfo },
            { no: 6, name: "proposal_seq", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 7, name: "proposals", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => Proposal },
            { no: 8, name: "votes", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => Vote }
        ]);
    }
    create(value?: PartialMessage<GenesisState>): GenesisState {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.groupSeq = 0n;
        message.groups = [];
        message.groupMembers = [];
        message.groupPolicySeq = 0n;
        message.groupPolicies = [];
        message.proposalSeq = 0n;
        message.proposals = [];
        message.votes = [];
        if (value !== undefined)
            reflectionMergePartial<GenesisState>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GenesisState): GenesisState {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* uint64 group_seq */ 1:
                    message.groupSeq = reader.uint64().toBigInt();
                    break;
                case /* repeated cosmos.group.v1.GroupInfo groups */ 2:
                    message.groups.push(GroupInfo.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* repeated cosmos.group.v1.GroupMember group_members */ 3:
                    message.groupMembers.push(GroupMember.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* uint64 group_policy_seq */ 4:
                    message.groupPolicySeq = reader.uint64().toBigInt();
                    break;
                case /* repeated cosmos.group.v1.GroupPolicyInfo group_policies */ 5:
                    message.groupPolicies.push(GroupPolicyInfo.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* uint64 proposal_seq */ 6:
                    message.proposalSeq = reader.uint64().toBigInt();
                    break;
                case /* repeated cosmos.group.v1.Proposal proposals */ 7:
                    message.proposals.push(Proposal.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* repeated cosmos.group.v1.Vote votes */ 8:
                    message.votes.push(Vote.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: GenesisState, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* uint64 group_seq = 1; */
        if (message.groupSeq !== 0n)
            writer.tag(1, WireType.Varint).uint64(message.groupSeq);
        /* repeated cosmos.group.v1.GroupInfo groups = 2; */
        for (let i = 0; i < message.groups.length; i++)
            GroupInfo.internalBinaryWrite(message.groups[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* repeated cosmos.group.v1.GroupMember group_members = 3; */
        for (let i = 0; i < message.groupMembers.length; i++)
            GroupMember.internalBinaryWrite(message.groupMembers[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        /* uint64 group_policy_seq = 4; */
        if (message.groupPolicySeq !== 0n)
            writer.tag(4, WireType.Varint).uint64(message.groupPolicySeq);
        /* repeated cosmos.group.v1.GroupPolicyInfo group_policies = 5; */
        for (let i = 0; i < message.groupPolicies.length; i++)
            GroupPolicyInfo.internalBinaryWrite(message.groupPolicies[i], writer.tag(5, WireType.LengthDelimited).fork(), options).join();
        /* uint64 proposal_seq = 6; */
        if (message.proposalSeq !== 0n)
            writer.tag(6, WireType.Varint).uint64(message.proposalSeq);
        /* repeated cosmos.group.v1.Proposal proposals = 7; */
        for (let i = 0; i < message.proposals.length; i++)
            Proposal.internalBinaryWrite(message.proposals[i], writer.tag(7, WireType.LengthDelimited).fork(), options).join();
        /* repeated cosmos.group.v1.Vote votes = 8; */
        for (let i = 0; i < message.votes.length; i++)
            Vote.internalBinaryWrite(message.votes[i], writer.tag(8, 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 cosmos.group.v1.GenesisState
 */
export const GenesisState = new GenesisState$Type();
