"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventEpochStart = exports.EventEpochEnd = void 0;
const binary_1 = require("../../../binary");
function createBaseEventEpochEnd() {
    return {
        epochNumber: BigInt(0)
    };
}
/**
 * EventEpochEnd is an event emitted when an epoch end.
 * @name EventEpochEnd
 * @package cosmos.epochs.v1beta1
 * @see proto type: cosmos.epochs.v1beta1.EventEpochEnd
 */
exports.EventEpochEnd = {
    typeUrl: "/cosmos.epochs.v1beta1.EventEpochEnd",
    aminoType: "cosmos-sdk/EventEpochEnd",
    is(o) {
        return o && (o.$typeUrl === exports.EventEpochEnd.typeUrl || typeof o.epochNumber === "bigint");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.EventEpochEnd.typeUrl || typeof o.epoch_number === "bigint");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.epochNumber !== BigInt(0)) {
            writer.uint32(8).int64(message.epochNumber);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseEventEpochEnd();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.epochNumber = reader.int64();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseEventEpochEnd();
        message.epochNumber = object.epochNumber !== undefined && object.epochNumber !== null ? BigInt(object.epochNumber.toString()) : BigInt(0);
        return message;
    },
    fromAmino(object) {
        const message = createBaseEventEpochEnd();
        if (object.epoch_number !== undefined && object.epoch_number !== null) {
            message.epochNumber = BigInt(object.epoch_number);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber?.toString() : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.EventEpochEnd.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/EventEpochEnd",
            value: exports.EventEpochEnd.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.EventEpochEnd.decode(message.value);
    },
    toProto(message) {
        return exports.EventEpochEnd.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.epochs.v1beta1.EventEpochEnd",
            value: exports.EventEpochEnd.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseEventEpochStart() {
    return {
        epochNumber: BigInt(0),
        epochStartTime: BigInt(0)
    };
}
/**
 * EventEpochStart is an event emitted when an epoch start.
 * @name EventEpochStart
 * @package cosmos.epochs.v1beta1
 * @see proto type: cosmos.epochs.v1beta1.EventEpochStart
 */
exports.EventEpochStart = {
    typeUrl: "/cosmos.epochs.v1beta1.EventEpochStart",
    aminoType: "cosmos-sdk/EventEpochStart",
    is(o) {
        return o && (o.$typeUrl === exports.EventEpochStart.typeUrl || typeof o.epochNumber === "bigint" && typeof o.epochStartTime === "bigint");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.EventEpochStart.typeUrl || typeof o.epoch_number === "bigint" && typeof o.epoch_start_time === "bigint");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.epochNumber !== BigInt(0)) {
            writer.uint32(8).int64(message.epochNumber);
        }
        if (message.epochStartTime !== BigInt(0)) {
            writer.uint32(16).int64(message.epochStartTime);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseEventEpochStart();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.epochNumber = reader.int64();
                    break;
                case 2:
                    message.epochStartTime = reader.int64();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseEventEpochStart();
        message.epochNumber = object.epochNumber !== undefined && object.epochNumber !== null ? BigInt(object.epochNumber.toString()) : BigInt(0);
        message.epochStartTime = object.epochStartTime !== undefined && object.epochStartTime !== null ? BigInt(object.epochStartTime.toString()) : BigInt(0);
        return message;
    },
    fromAmino(object) {
        const message = createBaseEventEpochStart();
        if (object.epoch_number !== undefined && object.epoch_number !== null) {
            message.epochNumber = BigInt(object.epoch_number);
        }
        if (object.epoch_start_time !== undefined && object.epoch_start_time !== null) {
            message.epochStartTime = BigInt(object.epoch_start_time);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber?.toString() : undefined;
        obj.epoch_start_time = message.epochStartTime !== BigInt(0) ? message.epochStartTime?.toString() : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.EventEpochStart.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/EventEpochStart",
            value: exports.EventEpochStart.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.EventEpochStart.decode(message.value);
    },
    toProto(message) {
        return exports.EventEpochStart.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.epochs.v1beta1.EventEpochStart",
            value: exports.EventEpochStart.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
