"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Metadata = void 0;
const binary_1 = require("../../../../binary");
const registry_1 = require("../../../../registry");
function createBaseMetadata() {
    return {
        feeVersion: "",
        appVersion: ""
    };
}
exports.Metadata = {
    typeUrl: "/ibc.applications.fee.v1.Metadata",
    aminoType: "cosmos-sdk/Metadata",
    is(o) {
        return o && (o.$typeUrl === exports.Metadata.typeUrl || typeof o.feeVersion === "string" && typeof o.appVersion === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.Metadata.typeUrl || typeof o.fee_version === "string" && typeof o.app_version === "string");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.feeVersion !== "") {
            writer.uint32(10).string(message.feeVersion);
        }
        if (message.appVersion !== "") {
            writer.uint32(18).string(message.appVersion);
        }
        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 = createBaseMetadata();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.feeVersion = reader.string();
                    break;
                case 2:
                    message.appVersion = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseMetadata();
        message.feeVersion = object.feeVersion ?? "";
        message.appVersion = object.appVersion ?? "";
        return message;
    },
    fromAmino(object) {
        const message = createBaseMetadata();
        if (object.fee_version !== undefined && object.fee_version !== null) {
            message.feeVersion = object.fee_version;
        }
        if (object.app_version !== undefined && object.app_version !== null) {
            message.appVersion = object.app_version;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.fee_version = message.feeVersion === "" ? undefined : message.feeVersion;
        obj.app_version = message.appVersion === "" ? undefined : message.appVersion;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.Metadata.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/Metadata",
            value: exports.Metadata.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.Metadata.decode(message.value);
    },
    toProto(message) {
        return exports.Metadata.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.applications.fee.v1.Metadata",
            value: exports.Metadata.encode(message).finish()
        };
    }
};
registry_1.GlobalDecoderRegistry.register(exports.Metadata.typeUrl, exports.Metadata);
registry_1.GlobalDecoderRegistry.registerAminoProtoMapping(exports.Metadata.aminoType, exports.Metadata.typeUrl);
