/**
 * Generated by the protoc-gen-ts.  DO NOT EDIT!
 * compiler version: 0.0.0
 * source: ads.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 mall {
    export class ByPosRequest extends pb_1.Message {
        #one_of_decls: number[][] = [];
        constructor(data?: any[] | {
            pos_key?: string[];
            store_identity?: string;
        }) {
            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 ("pos_key" in data && data.pos_key != undefined) {
                    this.pos_key = data.pos_key;
                }
                if ("store_identity" in data && data.store_identity != undefined) {
                    this.store_identity = data.store_identity;
                }
            }
        }
        get pos_key() {
            return pb_1.Message.getFieldWithDefault(this, 1, []) as string[];
        }
        set pos_key(value: string[]) {
            pb_1.Message.setField(this, 1, value);
        }
        get store_identity() {
            return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
        }
        set store_identity(value: string) {
            pb_1.Message.setField(this, 2, value);
        }
        static fromObject(data: {
            pos_key?: string[];
            store_identity?: string;
        }): ByPosRequest {
            const message = new ByPosRequest({});
            if (data.pos_key != null) {
                message.pos_key = data.pos_key;
            }
            if (data.store_identity != null) {
                message.store_identity = data.store_identity;
            }
            return message;
        }
        toObject() {
            const data: {
                pos_key?: string[];
                store_identity?: string;
            } = {};
            if (this.pos_key != null) {
                data.pos_key = this.pos_key;
            }
            if (this.store_identity != null) {
                data.store_identity = this.store_identity;
            }
            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.pos_key.length)
                writer.writeRepeatedString(1, this.pos_key);
            if (this.store_identity.length)
                writer.writeString(2, this.store_identity);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ByPosRequest {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ByPosRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        pb_1.Message.addToRepeatedField(message, 1, reader.readString());
                        break;
                    case 2:
                        message.store_identity = reader.readString();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary(): Uint8Array {
            return this.serialize();
        }
        static deserializeBinary(bytes: Uint8Array): ByPosRequest {
            return ByPosRequest.deserialize(bytes);
        }
    }
    export class AdsListReply extends pb_1.Message {
        #one_of_decls: number[][] = [];
        constructor(data?: any[] | {
            data?: AdsItem[];
            count?: number;
        }) {
            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 ("data" in data && data.data != undefined) {
                    this.data = data.data;
                }
                if ("count" in data && data.count != undefined) {
                    this.count = data.count;
                }
            }
        }
        get data() {
            return pb_1.Message.getRepeatedWrapperField(this, AdsItem, 1) as AdsItem[];
        }
        set data(value: AdsItem[]) {
            pb_1.Message.setRepeatedWrapperField(this, 1, value);
        }
        get count() {
            return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
        }
        set count(value: number) {
            pb_1.Message.setField(this, 2, value);
        }
        static fromObject(data: {
            data?: ReturnType<typeof AdsItem.prototype.toObject>[];
            count?: number;
        }): AdsListReply {
            const message = new AdsListReply({});
            if (data.data != null) {
                message.data = data.data.map(item => AdsItem.fromObject(item));
            }
            if (data.count != null) {
                message.count = data.count;
            }
            return message;
        }
        toObject() {
            const data: {
                data?: ReturnType<typeof AdsItem.prototype.toObject>[];
                count?: number;
            } = {};
            if (this.data != null) {
                data.data = this.data.map((item: AdsItem) => item.toObject());
            }
            if (this.count != null) {
                data.count = this.count;
            }
            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.data.length)
                writer.writeRepeatedMessage(1, this.data, (item: AdsItem) => item.serialize(writer));
            if (this.count != 0)
                writer.writeInt64(2, this.count);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes: Uint8Array | pb_1.BinaryReader): AdsListReply {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new AdsListReply();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        reader.readMessage(message.data, () => pb_1.Message.addToRepeatedWrapperField(message, 1, AdsItem.deserialize(reader), AdsItem));
                        break;
                    case 2:
                        message.count = reader.readInt64();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary(): Uint8Array {
            return this.serialize();
        }
        static deserializeBinary(bytes: Uint8Array): AdsListReply {
            return AdsListReply.deserialize(bytes);
        }
    }
    export class AdsItem extends pb_1.Message {
        #one_of_decls: number[][] = [];
        constructor(data?: any[] | {
            id?: number;
            pos_key?: string;
            title?: string;
            content?: string;
            type?: number;
            to_url?: string;
            created_at?: string;
            status?: 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 ("id" in data && data.id != undefined) {
                    this.id = data.id;
                }
                if ("pos_key" in data && data.pos_key != undefined) {
                    this.pos_key = data.pos_key;
                }
                if ("title" in data && data.title != undefined) {
                    this.title = data.title;
                }
                if ("content" in data && data.content != undefined) {
                    this.content = data.content;
                }
                if ("type" in data && data.type != undefined) {
                    this.type = data.type;
                }
                if ("to_url" in data && data.to_url != undefined) {
                    this.to_url = data.to_url;
                }
                if ("created_at" in data && data.created_at != undefined) {
                    this.created_at = data.created_at;
                }
                if ("status" in data && data.status != undefined) {
                    this.status = data.status;
                }
            }
        }
        get id() {
            return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
        }
        set id(value: number) {
            pb_1.Message.setField(this, 1, value);
        }
        get pos_key() {
            return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
        }
        set pos_key(value: string) {
            pb_1.Message.setField(this, 2, value);
        }
        get title() {
            return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
        }
        set title(value: string) {
            pb_1.Message.setField(this, 3, value);
        }
        get content() {
            return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
        }
        set content(value: string) {
            pb_1.Message.setField(this, 4, value);
        }
        get type() {
            return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
        }
        set type(value: number) {
            pb_1.Message.setField(this, 5, value);
        }
        get to_url() {
            return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
        }
        set to_url(value: string) {
            pb_1.Message.setField(this, 6, value);
        }
        get created_at() {
            return pb_1.Message.getFieldWithDefault(this, 7, "") as string;
        }
        set created_at(value: string) {
            pb_1.Message.setField(this, 7, value);
        }
        get status() {
            return pb_1.Message.getFieldWithDefault(this, 8, 0) as number;
        }
        set status(value: number) {
            pb_1.Message.setField(this, 8, value);
        }
        static fromObject(data: {
            id?: number;
            pos_key?: string;
            title?: string;
            content?: string;
            type?: number;
            to_url?: string;
            created_at?: string;
            status?: number;
        }): AdsItem {
            const message = new AdsItem({});
            if (data.id != null) {
                message.id = data.id;
            }
            if (data.pos_key != null) {
                message.pos_key = data.pos_key;
            }
            if (data.title != null) {
                message.title = data.title;
            }
            if (data.content != null) {
                message.content = data.content;
            }
            if (data.type != null) {
                message.type = data.type;
            }
            if (data.to_url != null) {
                message.to_url = data.to_url;
            }
            if (data.created_at != null) {
                message.created_at = data.created_at;
            }
            if (data.status != null) {
                message.status = data.status;
            }
            return message;
        }
        toObject() {
            const data: {
                id?: number;
                pos_key?: string;
                title?: string;
                content?: string;
                type?: number;
                to_url?: string;
                created_at?: string;
                status?: number;
            } = {};
            if (this.id != null) {
                data.id = this.id;
            }
            if (this.pos_key != null) {
                data.pos_key = this.pos_key;
            }
            if (this.title != null) {
                data.title = this.title;
            }
            if (this.content != null) {
                data.content = this.content;
            }
            if (this.type != null) {
                data.type = this.type;
            }
            if (this.to_url != null) {
                data.to_url = this.to_url;
            }
            if (this.created_at != null) {
                data.created_at = this.created_at;
            }
            if (this.status != null) {
                data.status = this.status;
            }
            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.id != 0)
                writer.writeInt64(1, this.id);
            if (this.pos_key.length)
                writer.writeString(2, this.pos_key);
            if (this.title.length)
                writer.writeString(3, this.title);
            if (this.content.length)
                writer.writeString(4, this.content);
            if (this.type != 0)
                writer.writeInt32(5, this.type);
            if (this.to_url.length)
                writer.writeString(6, this.to_url);
            if (this.created_at.length)
                writer.writeString(7, this.created_at);
            if (this.status != 0)
                writer.writeInt64(8, this.status);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes: Uint8Array | pb_1.BinaryReader): AdsItem {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new AdsItem();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.id = reader.readInt64();
                        break;
                    case 2:
                        message.pos_key = reader.readString();
                        break;
                    case 3:
                        message.title = reader.readString();
                        break;
                    case 4:
                        message.content = reader.readString();
                        break;
                    case 5:
                        message.type = reader.readInt32();
                        break;
                    case 6:
                        message.to_url = reader.readString();
                        break;
                    case 7:
                        message.created_at = reader.readString();
                        break;
                    case 8:
                        message.status = reader.readInt64();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary(): Uint8Array {
            return this.serialize();
        }
        static deserializeBinary(bytes: Uint8Array): AdsItem {
            return AdsItem.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 UnimplementedAdsService {
        static definition = {
            ByPos: {
                path: "/mall.Ads/ByPos",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: ByPosRequest) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => ByPosRequest.deserialize(new Uint8Array(bytes)),
                responseSerialize: (message: AdsListReply) => Buffer.from(message.serialize()),
                responseDeserialize: (bytes: Buffer) => AdsListReply.deserialize(new Uint8Array(bytes))
            },
            Fetch: {
                path: "/mall.Ads/Fetch",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: dependency_1.mall.FetchRequest) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => dependency_1.mall.FetchRequest.deserialize(new Uint8Array(bytes)),
                responseSerialize: (message: AdsListReply) => Buffer.from(message.serialize()),
                responseDeserialize: (bytes: Buffer) => AdsListReply.deserialize(new Uint8Array(bytes))
            },
            Create: {
                path: "/mall.Ads/Create",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: AdsItem) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => AdsItem.deserialize(new Uint8Array(bytes)),
                responseSerialize: (message: dependency_1.mall.StatusReply) => Buffer.from(message.serialize()),
                responseDeserialize: (bytes: Buffer) => dependency_1.mall.StatusReply.deserialize(new Uint8Array(bytes))
            },
            Modify: {
                path: "/mall.Ads/Modify",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: AdsItem) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => AdsItem.deserialize(new Uint8Array(bytes)),
                responseSerialize: (message: dependency_1.mall.StatusReply) => Buffer.from(message.serialize()),
                responseDeserialize: (bytes: Buffer) => dependency_1.mall.StatusReply.deserialize(new Uint8Array(bytes))
            },
            Delete: {
                path: "/mall.Ads/Delete",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: dependency_1.mall.IdentRequest) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => dependency_1.mall.IdentRequest.deserialize(new Uint8Array(bytes)),
                responseSerialize: (message: dependency_1.mall.StatusReply) => Buffer.from(message.serialize()),
                responseDeserialize: (bytes: Buffer) => dependency_1.mall.StatusReply.deserialize(new Uint8Array(bytes))
            }
        };
        [method: string]: grpc_1.UntypedHandleCall;
        abstract ByPos(call: grpc_1.ServerUnaryCall<ByPosRequest, AdsListReply>, callback: grpc_1.sendUnaryData<AdsListReply>): void;
        abstract Fetch(call: grpc_1.ServerUnaryCall<dependency_1.mall.FetchRequest, AdsListReply>, callback: grpc_1.sendUnaryData<AdsListReply>): void;
        abstract Create(call: grpc_1.ServerUnaryCall<AdsItem, dependency_1.mall.StatusReply>, callback: grpc_1.sendUnaryData<dependency_1.mall.StatusReply>): void;
        abstract Modify(call: grpc_1.ServerUnaryCall<AdsItem, dependency_1.mall.StatusReply>, callback: grpc_1.sendUnaryData<dependency_1.mall.StatusReply>): void;
        abstract Delete(call: grpc_1.ServerUnaryCall<dependency_1.mall.IdentRequest, dependency_1.mall.StatusReply>, callback: grpc_1.sendUnaryData<dependency_1.mall.StatusReply>): void;
    }
    export class AdsClient extends grpc_1.makeGenericClientConstructor(UnimplementedAdsService.definition, "Ads", {}) {
        constructor(address: string, credentials: grpc_1.ChannelCredentials, options?: Partial<grpc_1.ChannelOptions>) {
            super(address, credentials, options);
        }
        ByPos: GrpcUnaryServiceInterface<ByPosRequest, AdsListReply> = (message: ByPosRequest, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<AdsListReply>, options?: grpc_1.CallOptions | grpc_1.requestCallback<AdsListReply>, callback?: grpc_1.requestCallback<AdsListReply>): grpc_1.ClientUnaryCall => {
            return super.ByPos(message, metadata, options, callback);
        };
        Fetch: GrpcUnaryServiceInterface<dependency_1.mall.FetchRequest, AdsListReply> = (message: dependency_1.mall.FetchRequest, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<AdsListReply>, options?: grpc_1.CallOptions | grpc_1.requestCallback<AdsListReply>, callback?: grpc_1.requestCallback<AdsListReply>): grpc_1.ClientUnaryCall => {
            return super.Fetch(message, metadata, options, callback);
        };
        Create: GrpcUnaryServiceInterface<AdsItem, dependency_1.mall.StatusReply> = (message: AdsItem, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<dependency_1.mall.StatusReply>, options?: grpc_1.CallOptions | grpc_1.requestCallback<dependency_1.mall.StatusReply>, callback?: grpc_1.requestCallback<dependency_1.mall.StatusReply>): grpc_1.ClientUnaryCall => {
            return super.Create(message, metadata, options, callback);
        };
        Modify: GrpcUnaryServiceInterface<AdsItem, dependency_1.mall.StatusReply> = (message: AdsItem, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<dependency_1.mall.StatusReply>, options?: grpc_1.CallOptions | grpc_1.requestCallback<dependency_1.mall.StatusReply>, callback?: grpc_1.requestCallback<dependency_1.mall.StatusReply>): grpc_1.ClientUnaryCall => {
            return super.Modify(message, metadata, options, callback);
        };
        Delete: GrpcUnaryServiceInterface<dependency_1.mall.IdentRequest, dependency_1.mall.StatusReply> = (message: dependency_1.mall.IdentRequest, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<dependency_1.mall.StatusReply>, options?: grpc_1.CallOptions | grpc_1.requestCallback<dependency_1.mall.StatusReply>, callback?: grpc_1.requestCallback<dependency_1.mall.StatusReply>): grpc_1.ClientUnaryCall => {
            return super.Delete(message, metadata, options, callback);
        };
    }
}
