/**
 * Generated by the protoc-gen-ts.  DO NOT EDIT!
 * compiler version: 3.20.3
 * source: ibc/applications/transfer/v1/authz.proto
 * git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../../cosmos_proto/cosmos";
import * as dependency_2 from "./../../../../gogoproto/gogo";
import * as dependency_3 from "./../../../../cosmos/base/v1beta1/coin";
import * as pb_1 from "google-protobuf";
export namespace ibc.applications.transfer.v1 {
    export class Allocation extends pb_1.Message {
        #one_of_decls: number[][] = [];
        constructor(data?: any[] | {
            source_port?: string;
            source_channel?: string;
            spend_limit?: dependency_3.cosmos.base.v1beta1.Coin[];
            allow_list?: string[];
            allowed_packet_data?: string[];
        }) {
            super();
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 4, 5], this.#one_of_decls);
            if (!Array.isArray(data) && typeof data == "object") {
                if ("source_port" in data && data.source_port != undefined) {
                    this.source_port = data.source_port;
                }
                if ("source_channel" in data && data.source_channel != undefined) {
                    this.source_channel = data.source_channel;
                }
                if ("spend_limit" in data && data.spend_limit != undefined) {
                    this.spend_limit = data.spend_limit;
                }
                if ("allow_list" in data && data.allow_list != undefined) {
                    this.allow_list = data.allow_list;
                }
                if ("allowed_packet_data" in data && data.allowed_packet_data != undefined) {
                    this.allowed_packet_data = data.allowed_packet_data;
                }
            }
        }
        get source_port() {
            return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
        }
        set source_port(value: string) {
            pb_1.Message.setField(this, 1, value);
        }
        get source_channel() {
            return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
        }
        set source_channel(value: string) {
            pb_1.Message.setField(this, 2, value);
        }
        get spend_limit() {
            return pb_1.Message.getRepeatedWrapperField(this, dependency_3.cosmos.base.v1beta1.Coin, 3) as dependency_3.cosmos.base.v1beta1.Coin[];
        }
        set spend_limit(value: dependency_3.cosmos.base.v1beta1.Coin[]) {
            pb_1.Message.setRepeatedWrapperField(this, 3, value);
        }
        get allow_list() {
            return pb_1.Message.getFieldWithDefault(this, 4, []) as string[];
        }
        set allow_list(value: string[]) {
            pb_1.Message.setField(this, 4, value);
        }
        get allowed_packet_data() {
            return pb_1.Message.getFieldWithDefault(this, 5, []) as string[];
        }
        set allowed_packet_data(value: string[]) {
            pb_1.Message.setField(this, 5, value);
        }
        static fromObject(data: {
            source_port?: string;
            source_channel?: string;
            spend_limit?: ReturnType<typeof dependency_3.cosmos.base.v1beta1.Coin.prototype.toObject>[];
            allow_list?: string[];
            allowed_packet_data?: string[];
        }): Allocation {
            const message = new Allocation({});
            if (data.source_port != null) {
                message.source_port = data.source_port;
            }
            if (data.source_channel != null) {
                message.source_channel = data.source_channel;
            }
            if (data.spend_limit != null) {
                message.spend_limit = data.spend_limit.map(item => dependency_3.cosmos.base.v1beta1.Coin.fromObject(item));
            }
            if (data.allow_list != null) {
                message.allow_list = data.allow_list;
            }
            if (data.allowed_packet_data != null) {
                message.allowed_packet_data = data.allowed_packet_data;
            }
            return message;
        }
        toObject() {
            const data: {
                source_port?: string;
                source_channel?: string;
                spend_limit?: ReturnType<typeof dependency_3.cosmos.base.v1beta1.Coin.prototype.toObject>[];
                allow_list?: string[];
                allowed_packet_data?: string[];
            } = {};
            if (this.source_port != null) {
                data.source_port = this.source_port;
            }
            if (this.source_channel != null) {
                data.source_channel = this.source_channel;
            }
            if (this.spend_limit != null) {
                data.spend_limit = this.spend_limit.map((item: dependency_3.cosmos.base.v1beta1.Coin) => item.toObject());
            }
            if (this.allow_list != null) {
                data.allow_list = this.allow_list;
            }
            if (this.allowed_packet_data != null) {
                data.allowed_packet_data = this.allowed_packet_data;
            }
            return data;
        }
        serialize(): Uint8Array;
        serialize(w: pb_1.BinaryWriter): void;
        serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
            const writer = w || new pb_1.BinaryWriter();
            if (this.source_port.length)
                writer.writeString(1, this.source_port);
            if (this.source_channel.length)
                writer.writeString(2, this.source_channel);
            if (this.spend_limit.length)
                writer.writeRepeatedMessage(3, this.spend_limit, (item: dependency_3.cosmos.base.v1beta1.Coin) => item.serialize(writer));
            if (this.allow_list.length)
                writer.writeRepeatedString(4, this.allow_list);
            if (this.allowed_packet_data.length)
                writer.writeRepeatedString(5, this.allowed_packet_data);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Allocation {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Allocation();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.source_port = reader.readString();
                        break;
                    case 2:
                        message.source_channel = reader.readString();
                        break;
                    case 3:
                        reader.readMessage(message.spend_limit, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_3.cosmos.base.v1beta1.Coin.deserialize(reader), dependency_3.cosmos.base.v1beta1.Coin));
                        break;
                    case 4:
                        pb_1.Message.addToRepeatedField(message, 4, reader.readString());
                        break;
                    case 5:
                        pb_1.Message.addToRepeatedField(message, 5, reader.readString());
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary(): Uint8Array {
            return this.serialize();
        }
        static deserializeBinary(bytes: Uint8Array): Allocation {
            return Allocation.deserialize(bytes);
        }
    }
    export class TransferAuthorization extends pb_1.Message {
        #one_of_decls: number[][] = [];
        constructor(data?: any[] | {
            allocations?: Allocation[];
        }) {
            super();
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls);
            if (!Array.isArray(data) && typeof data == "object") {
                if ("allocations" in data && data.allocations != undefined) {
                    this.allocations = data.allocations;
                }
            }
        }
        get allocations() {
            return pb_1.Message.getRepeatedWrapperField(this, Allocation, 1) as Allocation[];
        }
        set allocations(value: Allocation[]) {
            pb_1.Message.setRepeatedWrapperField(this, 1, value);
        }
        static fromObject(data: {
            allocations?: ReturnType<typeof Allocation.prototype.toObject>[];
        }): TransferAuthorization {
            const message = new TransferAuthorization({});
            if (data.allocations != null) {
                message.allocations = data.allocations.map(item => Allocation.fromObject(item));
            }
            return message;
        }
        toObject() {
            const data: {
                allocations?: ReturnType<typeof Allocation.prototype.toObject>[];
            } = {};
            if (this.allocations != null) {
                data.allocations = this.allocations.map((item: Allocation) => item.toObject());
            }
            return data;
        }
        serialize(): Uint8Array;
        serialize(w: pb_1.BinaryWriter): void;
        serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
            const writer = w || new pb_1.BinaryWriter();
            if (this.allocations.length)
                writer.writeRepeatedMessage(1, this.allocations, (item: Allocation) => item.serialize(writer));
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TransferAuthorization {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TransferAuthorization();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        reader.readMessage(message.allocations, () => pb_1.Message.addToRepeatedWrapperField(message, 1, Allocation.deserialize(reader), Allocation));
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary(): Uint8Array {
            return this.serialize();
        }
        static deserializeBinary(bytes: Uint8Array): TransferAuthorization {
            return TransferAuthorization.deserialize(bytes);
        }
    }
}
