// @generated by protobuf-ts 2.11.1 with parameter add_pb_suffix
// @generated from protobuf file "injective/insurance/v1beta1/genesis.proto" (package "injective.insurance.v1beta1", 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 { AddressVoucher } from "../../common/vouchers/v1/vouchers_pb";
import { FailedRedemptionSchedule } from "./insurance_pb";
import { RedemptionSchedule } from "./insurance_pb";
import { InsuranceFund } from "./insurance_pb";
import { Params } from "./insurance_pb";
/**
 * GenesisState defines the insurance module's genesis state.
 *
 * @generated from protobuf message injective.insurance.v1beta1.GenesisState
 */
export interface GenesisState {
    /**
     * params defines all the parameters of related to insurance.
     *
     * @generated from protobuf field: injective.insurance.v1beta1.Params params = 1
     */
    params?: Params;
    /**
     * insurance_funds describes the insurance funds available for derivative
     * markets
     *
     * @generated from protobuf field: repeated injective.insurance.v1beta1.InsuranceFund insurance_funds = 2
     */
    insuranceFunds: InsuranceFund[];
    /**
     * redemption_schedule describes the redemption requests pending
     *
     * @generated from protobuf field: repeated injective.insurance.v1beta1.RedemptionSchedule redemption_schedule = 3
     */
    redemptionSchedule: RedemptionSchedule[];
    /**
     * next_share_denom_id describes the next share denom id to be used for newly
     * creating insurance fund incremented by 1 per insurance fund creation
     *
     * @generated from protobuf field: uint64 next_share_denom_id = 4
     */
    nextShareDenomId: bigint;
    /**
     * next_redemption_schedule_id describes next redemption schedule id to be
     * used for next schedule incremented by 1 per redemption request
     *
     * @generated from protobuf field: uint64 next_redemption_schedule_id = 5
     */
    nextRedemptionScheduleId: bigint;
    /**
     * failed_redemption_schedules describes redemptions that failed during
     * settlement and are preserved for manual resolution
     *
     * @generated from protobuf field: repeated injective.insurance.v1beta1.FailedRedemptionSchedule failed_redemption_schedules = 6
     */
    failedRedemptionSchedules: FailedRedemptionSchedule[];
    /**
     * next_failed_redemption_schedule_id describes the next id for failed
     * redemption schedules, incremented by 1 per failed settlement
     *
     * @generated from protobuf field: uint64 next_failed_redemption_schedule_id = 7
     */
    nextFailedRedemptionScheduleId: bigint;
    /**
     * outstanding vouchers (failed redemption deliveries)
     *
     * @generated from protobuf field: repeated injective.common.vouchers.v1.AddressVoucher vouchers = 8
     */
    vouchers: AddressVoucher[];
}
// @generated message type with reflection information, may provide speed optimized methods
class GenesisState$Type extends MessageType<GenesisState> {
    constructor() {
        super("injective.insurance.v1beta1.GenesisState", [
            { no: 1, name: "params", kind: "message", T: () => Params, options: { "gogoproto.nullable": false } },
            { no: 2, name: "insurance_funds", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => InsuranceFund, options: { "gogoproto.nullable": false } },
            { no: 3, name: "redemption_schedule", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => RedemptionSchedule, options: { "gogoproto.nullable": false } },
            { no: 4, name: "next_share_denom_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 5, name: "next_redemption_schedule_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 6, name: "failed_redemption_schedules", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => FailedRedemptionSchedule, options: { "gogoproto.nullable": false } },
            { no: 7, name: "next_failed_redemption_schedule_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 8, name: "vouchers", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => AddressVoucher, options: { "gogoproto.nullable": false } }
        ]);
    }
    create(value?: PartialMessage<GenesisState>): GenesisState {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.insuranceFunds = [];
        message.redemptionSchedule = [];
        message.nextShareDenomId = 0n;
        message.nextRedemptionScheduleId = 0n;
        message.failedRedemptionSchedules = [];
        message.nextFailedRedemptionScheduleId = 0n;
        message.vouchers = [];
        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 /* injective.insurance.v1beta1.Params params */ 1:
                    message.params = Params.internalBinaryRead(reader, reader.uint32(), options, message.params);
                    break;
                case /* repeated injective.insurance.v1beta1.InsuranceFund insurance_funds */ 2:
                    message.insuranceFunds.push(InsuranceFund.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* repeated injective.insurance.v1beta1.RedemptionSchedule redemption_schedule */ 3:
                    message.redemptionSchedule.push(RedemptionSchedule.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* uint64 next_share_denom_id */ 4:
                    message.nextShareDenomId = reader.uint64().toBigInt();
                    break;
                case /* uint64 next_redemption_schedule_id */ 5:
                    message.nextRedemptionScheduleId = reader.uint64().toBigInt();
                    break;
                case /* repeated injective.insurance.v1beta1.FailedRedemptionSchedule failed_redemption_schedules */ 6:
                    message.failedRedemptionSchedules.push(FailedRedemptionSchedule.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* uint64 next_failed_redemption_schedule_id */ 7:
                    message.nextFailedRedemptionScheduleId = reader.uint64().toBigInt();
                    break;
                case /* repeated injective.common.vouchers.v1.AddressVoucher vouchers */ 8:
                    message.vouchers.push(AddressVoucher.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 {
        /* injective.insurance.v1beta1.Params params = 1; */
        if (message.params)
            Params.internalBinaryWrite(message.params, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* repeated injective.insurance.v1beta1.InsuranceFund insurance_funds = 2; */
        for (let i = 0; i < message.insuranceFunds.length; i++)
            InsuranceFund.internalBinaryWrite(message.insuranceFunds[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* repeated injective.insurance.v1beta1.RedemptionSchedule redemption_schedule = 3; */
        for (let i = 0; i < message.redemptionSchedule.length; i++)
            RedemptionSchedule.internalBinaryWrite(message.redemptionSchedule[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        /* uint64 next_share_denom_id = 4; */
        if (message.nextShareDenomId !== 0n)
            writer.tag(4, WireType.Varint).uint64(message.nextShareDenomId);
        /* uint64 next_redemption_schedule_id = 5; */
        if (message.nextRedemptionScheduleId !== 0n)
            writer.tag(5, WireType.Varint).uint64(message.nextRedemptionScheduleId);
        /* repeated injective.insurance.v1beta1.FailedRedemptionSchedule failed_redemption_schedules = 6; */
        for (let i = 0; i < message.failedRedemptionSchedules.length; i++)
            FailedRedemptionSchedule.internalBinaryWrite(message.failedRedemptionSchedules[i], writer.tag(6, WireType.LengthDelimited).fork(), options).join();
        /* uint64 next_failed_redemption_schedule_id = 7; */
        if (message.nextFailedRedemptionScheduleId !== 0n)
            writer.tag(7, WireType.Varint).uint64(message.nextFailedRedemptionScheduleId);
        /* repeated injective.common.vouchers.v1.AddressVoucher vouchers = 8; */
        for (let i = 0; i < message.vouchers.length; i++)
            AddressVoucher.internalBinaryWrite(message.vouchers[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 injective.insurance.v1beta1.GenesisState
 */
export const GenesisState = new GenesisState$Type();
