/**
 * Generated by the protoc-gen-ts.  DO NOT EDIT!
 * compiler version: 0.0.0
 * source: data.proto
 * git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./blocks";
import * as pb_1 from "google-protobuf";
import * as grpc_1 from "@grpc/grpc-js";
export namespace market {
    export class OverviewReply extends pb_1.Message {
        #one_of_decls: number[][] = [];
        constructor(data?: any[] | {
            total_approve?: number;
            total_month?: number;
            total_all?: number;
            total_staff?: number;
            report_month?: Map<string, number>;
            report_staff?: Map<string, number>;
        }) {
            super();
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
            if (!Array.isArray(data) && typeof data == "object") {
                if ("total_approve" in data && data.total_approve != undefined) {
                    this.total_approve = data.total_approve;
                }
                if ("total_month" in data && data.total_month != undefined) {
                    this.total_month = data.total_month;
                }
                if ("total_all" in data && data.total_all != undefined) {
                    this.total_all = data.total_all;
                }
                if ("total_staff" in data && data.total_staff != undefined) {
                    this.total_staff = data.total_staff;
                }
                if ("report_month" in data && data.report_month != undefined) {
                    this.report_month = data.report_month;
                }
                if ("report_staff" in data && data.report_staff != undefined) {
                    this.report_staff = data.report_staff;
                }
            }
            if (!this.report_month)
                this.report_month = new Map();
            if (!this.report_staff)
                this.report_staff = new Map();
        }
        get total_approve() {
            return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
        }
        set total_approve(value: number) {
            pb_1.Message.setField(this, 1, value);
        }
        get total_month() {
            return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
        }
        set total_month(value: number) {
            pb_1.Message.setField(this, 2, value);
        }
        get total_all() {
            return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
        }
        set total_all(value: number) {
            pb_1.Message.setField(this, 3, value);
        }
        get total_staff() {
            return pb_1.Message.getFieldWithDefault(this, 4, 0) as number;
        }
        set total_staff(value: number) {
            pb_1.Message.setField(this, 4, value);
        }
        get report_month() {
            return pb_1.Message.getField(this, 5) as any as Map<string, number>;
        }
        set report_month(value: Map<string, number>) {
            pb_1.Message.setField(this, 5, value as any);
        }
        get report_staff() {
            return pb_1.Message.getField(this, 6) as any as Map<string, number>;
        }
        set report_staff(value: Map<string, number>) {
            pb_1.Message.setField(this, 6, value as any);
        }
        static fromObject(data: {
            total_approve?: number;
            total_month?: number;
            total_all?: number;
            total_staff?: number;
            report_month?: {
                [key: string]: number;
            };
            report_staff?: {
                [key: string]: number;
            };
        }): OverviewReply {
            const message = new OverviewReply({});
            if (data.total_approve != null) {
                message.total_approve = data.total_approve;
            }
            if (data.total_month != null) {
                message.total_month = data.total_month;
            }
            if (data.total_all != null) {
                message.total_all = data.total_all;
            }
            if (data.total_staff != null) {
                message.total_staff = data.total_staff;
            }
            if (typeof data.report_month == "object") {
                message.report_month = new Map(Object.entries(data.report_month));
            }
            if (typeof data.report_staff == "object") {
                message.report_staff = new Map(Object.entries(data.report_staff));
            }
            return message;
        }
        toObject() {
            const data: {
                total_approve?: number;
                total_month?: number;
                total_all?: number;
                total_staff?: number;
                report_month?: {
                    [key: string]: number;
                };
                report_staff?: {
                    [key: string]: number;
                };
            } = {};
            if (this.total_approve != null) {
                data.total_approve = this.total_approve;
            }
            if (this.total_month != null) {
                data.total_month = this.total_month;
            }
            if (this.total_all != null) {
                data.total_all = this.total_all;
            }
            if (this.total_staff != null) {
                data.total_staff = this.total_staff;
            }
            if (this.report_month != null) {
                data.report_month = (Object.fromEntries)(this.report_month);
            }
            if (this.report_staff != null) {
                data.report_staff = (Object.fromEntries)(this.report_staff);
            }
            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.total_approve != 0)
                writer.writeInt64(1, this.total_approve);
            if (this.total_month != 0)
                writer.writeInt64(2, this.total_month);
            if (this.total_all != 0)
                writer.writeInt64(3, this.total_all);
            if (this.total_staff != 0)
                writer.writeInt64(4, this.total_staff);
            for (const [key, value] of this.report_month) {
                writer.writeMessage(5, this.report_month, () => {
                    writer.writeString(1, key);
                    writer.writeInt64(2, value);
                });
            }
            for (const [key, value] of this.report_staff) {
                writer.writeMessage(6, this.report_staff, () => {
                    writer.writeString(1, key);
                    writer.writeInt64(2, value);
                });
            }
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes: Uint8Array | pb_1.BinaryReader): OverviewReply {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new OverviewReply();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.total_approve = reader.readInt64();
                        break;
                    case 2:
                        message.total_month = reader.readInt64();
                        break;
                    case 3:
                        message.total_all = reader.readInt64();
                        break;
                    case 4:
                        message.total_staff = reader.readInt64();
                        break;
                    case 5:
                        reader.readMessage(message, () => pb_1.Map.deserializeBinary(message.report_month as any, reader, reader.readString, reader.readInt64));
                        break;
                    case 6:
                        reader.readMessage(message, () => pb_1.Map.deserializeBinary(message.report_staff as any, reader, reader.readString, reader.readInt64));
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary(): Uint8Array {
            return this.serialize();
        }
        static deserializeBinary(bytes: Uint8Array): OverviewReply {
            return OverviewReply.deserialize(bytes);
        }
    }
    export class DataReply extends pb_1.Message {
        #one_of_decls: number[][] = [];
        constructor(data?: any[] | {
            count?: number;
            data?: KeyVal[];
        }) {
            super();
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
            if (!Array.isArray(data) && typeof data == "object") {
                if ("count" in data && data.count != undefined) {
                    this.count = data.count;
                }
                if ("data" in data && data.data != undefined) {
                    this.data = data.data;
                }
            }
        }
        get count() {
            return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
        }
        set count(value: number) {
            pb_1.Message.setField(this, 1, value);
        }
        get data() {
            return pb_1.Message.getRepeatedWrapperField(this, KeyVal, 2) as KeyVal[];
        }
        set data(value: KeyVal[]) {
            pb_1.Message.setRepeatedWrapperField(this, 2, value);
        }
        static fromObject(data: {
            count?: number;
            data?: ReturnType<typeof KeyVal.prototype.toObject>[];
        }): DataReply {
            const message = new DataReply({});
            if (data.count != null) {
                message.count = data.count;
            }
            if (data.data != null) {
                message.data = data.data.map(item => KeyVal.fromObject(item));
            }
            return message;
        }
        toObject() {
            const data: {
                count?: number;
                data?: ReturnType<typeof KeyVal.prototype.toObject>[];
            } = {};
            if (this.count != null) {
                data.count = this.count;
            }
            if (this.data != null) {
                data.data = this.data.map((item: KeyVal) => 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.count != 0)
                writer.writeInt64(1, this.count);
            if (this.data.length)
                writer.writeRepeatedMessage(2, this.data, (item: KeyVal) => item.serialize(writer));
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DataReply {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DataReply();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.count = reader.readInt64();
                        break;
                    case 2:
                        reader.readMessage(message.data, () => pb_1.Message.addToRepeatedWrapperField(message, 2, KeyVal.deserialize(reader), KeyVal));
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary(): Uint8Array {
            return this.serialize();
        }
        static deserializeBinary(bytes: Uint8Array): DataReply {
            return DataReply.deserialize(bytes);
        }
    }
    export class KeyVal extends pb_1.Message {
        #one_of_decls: number[][] = [];
        constructor(data?: any[] | {
            key?: string;
            val?: string;
        }) {
            super();
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
            if (!Array.isArray(data) && typeof data == "object") {
                if ("key" in data && data.key != undefined) {
                    this.key = data.key;
                }
                if ("val" in data && data.val != undefined) {
                    this.val = data.val;
                }
            }
        }
        get key() {
            return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
        }
        set key(value: string) {
            pb_1.Message.setField(this, 1, value);
        }
        get val() {
            return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
        }
        set val(value: string) {
            pb_1.Message.setField(this, 2, value);
        }
        static fromObject(data: {
            key?: string;
            val?: string;
        }): KeyVal {
            const message = new KeyVal({});
            if (data.key != null) {
                message.key = data.key;
            }
            if (data.val != null) {
                message.val = data.val;
            }
            return message;
        }
        toObject() {
            const data: {
                key?: string;
                val?: string;
            } = {};
            if (this.key != null) {
                data.key = this.key;
            }
            if (this.val != null) {
                data.val = this.val;
            }
            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.key.length)
                writer.writeString(1, this.key);
            if (this.val.length)
                writer.writeString(2, this.val);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes: Uint8Array | pb_1.BinaryReader): KeyVal {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new KeyVal();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.key = reader.readString();
                        break;
                    case 2:
                        message.val = reader.readString();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary(): Uint8Array {
            return this.serialize();
        }
        static deserializeBinary(bytes: Uint8Array): KeyVal {
            return KeyVal.deserialize(bytes);
        }
    }
    interface GrpcUnaryServiceInterface<P, R> {
        (message: P, metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback<R>): grpc_1.ClientUnaryCall;
        (message: P, metadata: grpc_1.Metadata, callback: grpc_1.requestCallback<R>): grpc_1.ClientUnaryCall;
        (message: P, options: grpc_1.CallOptions, callback: grpc_1.requestCallback<R>): grpc_1.ClientUnaryCall;
        (message: P, callback: grpc_1.requestCallback<R>): grpc_1.ClientUnaryCall;
    }
    interface GrpcStreamServiceInterface<P, R> {
        (message: P, metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream<R>;
        (message: P, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream<R>;
    }
    interface GrpWritableServiceInterface<P, R> {
        (metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback<R>): grpc_1.ClientWritableStream<P>;
        (metadata: grpc_1.Metadata, callback: grpc_1.requestCallback<R>): grpc_1.ClientWritableStream<P>;
        (options: grpc_1.CallOptions, callback: grpc_1.requestCallback<R>): grpc_1.ClientWritableStream<P>;
        (callback: grpc_1.requestCallback<R>): grpc_1.ClientWritableStream<P>;
    }
    interface GrpcChunkServiceInterface<P, R> {
        (metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream<P, R>;
        (options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream<P, R>;
    }
    interface GrpcPromiseServiceInterface<P, R> {
        (message: P, metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): Promise<R>;
        (message: P, options?: grpc_1.CallOptions): Promise<R>;
    }
    export abstract class UnimplementedDataService {
        static definition = {
            Overview: {
                path: "/market.Data/Overview",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: dependency_1.market.Empty) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => dependency_1.market.Empty.deserialize(new Uint8Array(bytes)),
                responseSerialize: (message: OverviewReply) => Buffer.from(message.serialize()),
                responseDeserialize: (bytes: Buffer) => OverviewReply.deserialize(new Uint8Array(bytes))
            },
            MemberFetch: {
                path: "/market.Data/MemberFetch",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: dependency_1.market.FetchRequest) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => dependency_1.market.FetchRequest.deserialize(new Uint8Array(bytes)),
                responseSerialize: (message: DataReply) => Buffer.from(message.serialize()),
                responseDeserialize: (bytes: Buffer) => DataReply.deserialize(new Uint8Array(bytes))
            },
            MemberDetails: {
                path: "/market.Data/MemberDetails",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: dependency_1.market.IdentRequest) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => dependency_1.market.IdentRequest.deserialize(new Uint8Array(bytes)),
                responseSerialize: (message: KeyVal) => Buffer.from(message.serialize()),
                responseDeserialize: (bytes: Buffer) => KeyVal.deserialize(new Uint8Array(bytes))
            },
            OrderFetch: {
                path: "/market.Data/OrderFetch",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: dependency_1.market.FetchRequest) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => dependency_1.market.FetchRequest.deserialize(new Uint8Array(bytes)),
                responseSerialize: (message: DataReply) => Buffer.from(message.serialize()),
                responseDeserialize: (bytes: Buffer) => DataReply.deserialize(new Uint8Array(bytes))
            },
            OrderDetails: {
                path: "/market.Data/OrderDetails",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: dependency_1.market.IdentRequest) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => dependency_1.market.IdentRequest.deserialize(new Uint8Array(bytes)),
                responseSerialize: (message: KeyVal) => Buffer.from(message.serialize()),
                responseDeserialize: (bytes: Buffer) => KeyVal.deserialize(new Uint8Array(bytes))
            }
        };
        [method: string]: grpc_1.UntypedHandleCall;
        abstract Overview(call: grpc_1.ServerUnaryCall<dependency_1.market.Empty, OverviewReply>, callback: grpc_1.sendUnaryData<OverviewReply>): void;
        abstract MemberFetch(call: grpc_1.ServerUnaryCall<dependency_1.market.FetchRequest, DataReply>, callback: grpc_1.sendUnaryData<DataReply>): void;
        abstract MemberDetails(call: grpc_1.ServerUnaryCall<dependency_1.market.IdentRequest, KeyVal>, callback: grpc_1.sendUnaryData<KeyVal>): void;
        abstract OrderFetch(call: grpc_1.ServerUnaryCall<dependency_1.market.FetchRequest, DataReply>, callback: grpc_1.sendUnaryData<DataReply>): void;
        abstract OrderDetails(call: grpc_1.ServerUnaryCall<dependency_1.market.IdentRequest, KeyVal>, callback: grpc_1.sendUnaryData<KeyVal>): void;
    }
    export class DataClient extends grpc_1.makeGenericClientConstructor(UnimplementedDataService.definition, "Data", {}) {
        constructor(address: string, credentials: grpc_1.ChannelCredentials, options?: Partial<grpc_1.ChannelOptions>) {
            super(address, credentials, options);
        }
        Overview: GrpcUnaryServiceInterface<dependency_1.market.Empty, OverviewReply> = (message: dependency_1.market.Empty, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<OverviewReply>, options?: grpc_1.CallOptions | grpc_1.requestCallback<OverviewReply>, callback?: grpc_1.requestCallback<OverviewReply>): grpc_1.ClientUnaryCall => {
            return super.Overview(message, metadata, options, callback);
        };
        MemberFetch: GrpcUnaryServiceInterface<dependency_1.market.FetchRequest, DataReply> = (message: dependency_1.market.FetchRequest, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<DataReply>, options?: grpc_1.CallOptions | grpc_1.requestCallback<DataReply>, callback?: grpc_1.requestCallback<DataReply>): grpc_1.ClientUnaryCall => {
            return super.MemberFetch(message, metadata, options, callback);
        };
        MemberDetails: GrpcUnaryServiceInterface<dependency_1.market.IdentRequest, KeyVal> = (message: dependency_1.market.IdentRequest, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<KeyVal>, options?: grpc_1.CallOptions | grpc_1.requestCallback<KeyVal>, callback?: grpc_1.requestCallback<KeyVal>): grpc_1.ClientUnaryCall => {
            return super.MemberDetails(message, metadata, options, callback);
        };
        OrderFetch: GrpcUnaryServiceInterface<dependency_1.market.FetchRequest, DataReply> = (message: dependency_1.market.FetchRequest, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<DataReply>, options?: grpc_1.CallOptions | grpc_1.requestCallback<DataReply>, callback?: grpc_1.requestCallback<DataReply>): grpc_1.ClientUnaryCall => {
            return super.OrderFetch(message, metadata, options, callback);
        };
        OrderDetails: GrpcUnaryServiceInterface<dependency_1.market.IdentRequest, KeyVal> = (message: dependency_1.market.IdentRequest, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<KeyVal>, options?: grpc_1.CallOptions | grpc_1.requestCallback<KeyVal>, callback?: grpc_1.requestCallback<KeyVal>): grpc_1.ClientUnaryCall => {
            return super.OrderDetails(message, metadata, options, callback);
        };
    }
}
