/**
 * Generated by the protoc-gen-ts.  DO NOT EDIT!
 * compiler version: 0.0.0
 * source: category.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 CategoryFetchRequest extends pb_1.Message {
        #one_of_decls: number[][] = [];
        constructor(data?: any[] | {
            types?: string;
            keywords?: string;
            id?: number;
            store_identity?: 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 ("types" in data && data.types != undefined) {
                    this.types = data.types;
                }
                if ("keywords" in data && data.keywords != undefined) {
                    this.keywords = data.keywords;
                }
                if ("id" in data && data.id != undefined) {
                    this.id = data.id;
                }
                if ("store_identity" in data && data.store_identity != undefined) {
                    this.store_identity = data.store_identity;
                }
            }
        }
        get types() {
            return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
        }
        set types(value: string) {
            pb_1.Message.setField(this, 1, value);
        }
        get keywords() {
            return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
        }
        set keywords(value: string) {
            pb_1.Message.setField(this, 2, value);
        }
        get id() {
            return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
        }
        set id(value: number) {
            pb_1.Message.setField(this, 3, value);
        }
        get store_identity() {
            return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
        }
        set store_identity(value: string) {
            pb_1.Message.setField(this, 4, value);
        }
        static fromObject(data: {
            types?: string;
            keywords?: string;
            id?: number;
            store_identity?: string;
        }): CategoryFetchRequest {
            const message = new CategoryFetchRequest({});
            if (data.types != null) {
                message.types = data.types;
            }
            if (data.keywords != null) {
                message.keywords = data.keywords;
            }
            if (data.id != null) {
                message.id = data.id;
            }
            if (data.store_identity != null) {
                message.store_identity = data.store_identity;
            }
            return message;
        }
        toObject() {
            const data: {
                types?: string;
                keywords?: string;
                id?: number;
                store_identity?: string;
            } = {};
            if (this.types != null) {
                data.types = this.types;
            }
            if (this.keywords != null) {
                data.keywords = this.keywords;
            }
            if (this.id != null) {
                data.id = this.id;
            }
            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.types.length)
                writer.writeString(1, this.types);
            if (this.keywords.length)
                writer.writeString(2, this.keywords);
            if (this.id != 0)
                writer.writeInt64(3, this.id);
            if (this.store_identity.length)
                writer.writeString(4, this.store_identity);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CategoryFetchRequest {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CategoryFetchRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.types = reader.readString();
                        break;
                    case 2:
                        message.keywords = reader.readString();
                        break;
                    case 3:
                        message.id = reader.readInt64();
                        break;
                    case 4:
                        message.store_identity = reader.readString();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary(): Uint8Array {
            return this.serialize();
        }
        static deserializeBinary(bytes: Uint8Array): CategoryFetchRequest {
            return CategoryFetchRequest.deserialize(bytes);
        }
    }
    export class CategoryReply extends pb_1.Message {
        #one_of_decls: number[][] = [];
        constructor(data?: any[] | {
            count?: number;
            data?: CategoryItem[];
        }) {
            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, CategoryItem, 2) as CategoryItem[];
        }
        set data(value: CategoryItem[]) {
            pb_1.Message.setRepeatedWrapperField(this, 2, value);
        }
        static fromObject(data: {
            count?: number;
            data?: ReturnType<typeof CategoryItem.prototype.toObject>[];
        }): CategoryReply {
            const message = new CategoryReply({});
            if (data.count != null) {
                message.count = data.count;
            }
            if (data.data != null) {
                message.data = data.data.map(item => CategoryItem.fromObject(item));
            }
            return message;
        }
        toObject() {
            const data: {
                count?: number;
                data?: ReturnType<typeof CategoryItem.prototype.toObject>[];
            } = {};
            if (this.count != null) {
                data.count = this.count;
            }
            if (this.data != null) {
                data.data = this.data.map((item: CategoryItem) => 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: CategoryItem) => item.serialize(writer));
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CategoryReply {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CategoryReply();
            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, CategoryItem.deserialize(reader), CategoryItem));
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary(): Uint8Array {
            return this.serialize();
        }
        static deserializeBinary(bytes: Uint8Array): CategoryReply {
            return CategoryReply.deserialize(bytes);
        }
    }
    export class CategoryItem extends pb_1.Message {
        #one_of_decls: number[][] = [];
        constructor(data?: any[] | {
            id?: number;
            identity?: string;
            title?: string;
            en_title?: string;
            parent_id?: number;
            paths?: string;
            intro?: string;
            icon?: string;
            sort?: number;
            status?: number;
            created_at?: string;
            categories?: CategoryItem[];
            keys?: string;
        }) {
            super();
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [12], this.#one_of_decls);
            if (!Array.isArray(data) && typeof data == "object") {
                if ("id" in data && data.id != undefined) {
                    this.id = data.id;
                }
                if ("identity" in data && data.identity != undefined) {
                    this.identity = data.identity;
                }
                if ("title" in data && data.title != undefined) {
                    this.title = data.title;
                }
                if ("en_title" in data && data.en_title != undefined) {
                    this.en_title = data.en_title;
                }
                if ("parent_id" in data && data.parent_id != undefined) {
                    this.parent_id = data.parent_id;
                }
                if ("paths" in data && data.paths != undefined) {
                    this.paths = data.paths;
                }
                if ("intro" in data && data.intro != undefined) {
                    this.intro = data.intro;
                }
                if ("icon" in data && data.icon != undefined) {
                    this.icon = data.icon;
                }
                if ("sort" in data && data.sort != undefined) {
                    this.sort = data.sort;
                }
                if ("status" in data && data.status != undefined) {
                    this.status = data.status;
                }
                if ("created_at" in data && data.created_at != undefined) {
                    this.created_at = data.created_at;
                }
                if ("categories" in data && data.categories != undefined) {
                    this.categories = data.categories;
                }
                if ("keys" in data && data.keys != undefined) {
                    this.keys = data.keys;
                }
            }
        }
        get id() {
            return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
        }
        set id(value: number) {
            pb_1.Message.setField(this, 1, value);
        }
        get identity() {
            return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
        }
        set identity(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 en_title() {
            return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
        }
        set en_title(value: string) {
            pb_1.Message.setField(this, 4, value);
        }
        get parent_id() {
            return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
        }
        set parent_id(value: number) {
            pb_1.Message.setField(this, 5, value);
        }
        get paths() {
            return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
        }
        set paths(value: string) {
            pb_1.Message.setField(this, 6, value);
        }
        get intro() {
            return pb_1.Message.getFieldWithDefault(this, 7, "") as string;
        }
        set intro(value: string) {
            pb_1.Message.setField(this, 7, value);
        }
        get icon() {
            return pb_1.Message.getFieldWithDefault(this, 8, "") as string;
        }
        set icon(value: string) {
            pb_1.Message.setField(this, 8, value);
        }
        get sort() {
            return pb_1.Message.getFieldWithDefault(this, 9, 0) as number;
        }
        set sort(value: number) {
            pb_1.Message.setField(this, 9, value);
        }
        get status() {
            return pb_1.Message.getFieldWithDefault(this, 10, 0) as number;
        }
        set status(value: number) {
            pb_1.Message.setField(this, 10, value);
        }
        get created_at() {
            return pb_1.Message.getFieldWithDefault(this, 11, "") as string;
        }
        set created_at(value: string) {
            pb_1.Message.setField(this, 11, value);
        }
        get categories() {
            return pb_1.Message.getRepeatedWrapperField(this, CategoryItem, 12) as CategoryItem[];
        }
        set categories(value: CategoryItem[]) {
            pb_1.Message.setRepeatedWrapperField(this, 12, value);
        }
        get keys() {
            return pb_1.Message.getFieldWithDefault(this, 13, "") as string;
        }
        set keys(value: string) {
            pb_1.Message.setField(this, 13, value);
        }
        static fromObject(data: {
            id?: number;
            identity?: string;
            title?: string;
            en_title?: string;
            parent_id?: number;
            paths?: string;
            intro?: string;
            icon?: string;
            sort?: number;
            status?: number;
            created_at?: string;
            categories?: ReturnType<typeof CategoryItem.prototype.toObject>[];
            keys?: string;
        }): CategoryItem {
            const message = new CategoryItem({});
            if (data.id != null) {
                message.id = data.id;
            }
            if (data.identity != null) {
                message.identity = data.identity;
            }
            if (data.title != null) {
                message.title = data.title;
            }
            if (data.en_title != null) {
                message.en_title = data.en_title;
            }
            if (data.parent_id != null) {
                message.parent_id = data.parent_id;
            }
            if (data.paths != null) {
                message.paths = data.paths;
            }
            if (data.intro != null) {
                message.intro = data.intro;
            }
            if (data.icon != null) {
                message.icon = data.icon;
            }
            if (data.sort != null) {
                message.sort = data.sort;
            }
            if (data.status != null) {
                message.status = data.status;
            }
            if (data.created_at != null) {
                message.created_at = data.created_at;
            }
            if (data.categories != null) {
                message.categories = data.categories.map(item => CategoryItem.fromObject(item));
            }
            if (data.keys != null) {
                message.keys = data.keys;
            }
            return message;
        }
        toObject() {
            const data: {
                id?: number;
                identity?: string;
                title?: string;
                en_title?: string;
                parent_id?: number;
                paths?: string;
                intro?: string;
                icon?: string;
                sort?: number;
                status?: number;
                created_at?: string;
                categories?: ReturnType<typeof CategoryItem.prototype.toObject>[];
                keys?: string;
            } = {};
            if (this.id != null) {
                data.id = this.id;
            }
            if (this.identity != null) {
                data.identity = this.identity;
            }
            if (this.title != null) {
                data.title = this.title;
            }
            if (this.en_title != null) {
                data.en_title = this.en_title;
            }
            if (this.parent_id != null) {
                data.parent_id = this.parent_id;
            }
            if (this.paths != null) {
                data.paths = this.paths;
            }
            if (this.intro != null) {
                data.intro = this.intro;
            }
            if (this.icon != null) {
                data.icon = this.icon;
            }
            if (this.sort != null) {
                data.sort = this.sort;
            }
            if (this.status != null) {
                data.status = this.status;
            }
            if (this.created_at != null) {
                data.created_at = this.created_at;
            }
            if (this.categories != null) {
                data.categories = this.categories.map((item: CategoryItem) => item.toObject());
            }
            if (this.keys != null) {
                data.keys = this.keys;
            }
            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.identity.length)
                writer.writeString(2, this.identity);
            if (this.title.length)
                writer.writeString(3, this.title);
            if (this.en_title.length)
                writer.writeString(4, this.en_title);
            if (this.parent_id != 0)
                writer.writeInt64(5, this.parent_id);
            if (this.paths.length)
                writer.writeString(6, this.paths);
            if (this.intro.length)
                writer.writeString(7, this.intro);
            if (this.icon.length)
                writer.writeString(8, this.icon);
            if (this.sort != 0)
                writer.writeInt32(9, this.sort);
            if (this.status != 0)
                writer.writeInt32(10, this.status);
            if (this.created_at.length)
                writer.writeString(11, this.created_at);
            if (this.categories.length)
                writer.writeRepeatedMessage(12, this.categories, (item: CategoryItem) => item.serialize(writer));
            if (this.keys.length)
                writer.writeString(13, this.keys);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CategoryItem {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CategoryItem();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.id = reader.readInt64();
                        break;
                    case 2:
                        message.identity = reader.readString();
                        break;
                    case 3:
                        message.title = reader.readString();
                        break;
                    case 4:
                        message.en_title = reader.readString();
                        break;
                    case 5:
                        message.parent_id = reader.readInt64();
                        break;
                    case 6:
                        message.paths = reader.readString();
                        break;
                    case 7:
                        message.intro = reader.readString();
                        break;
                    case 8:
                        message.icon = reader.readString();
                        break;
                    case 9:
                        message.sort = reader.readInt32();
                        break;
                    case 10:
                        message.status = reader.readInt32();
                        break;
                    case 11:
                        message.created_at = reader.readString();
                        break;
                    case 12:
                        reader.readMessage(message.categories, () => pb_1.Message.addToRepeatedWrapperField(message, 12, CategoryItem.deserialize(reader), CategoryItem));
                        break;
                    case 13:
                        message.keys = reader.readString();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary(): Uint8Array {
            return this.serialize();
        }
        static deserializeBinary(bytes: Uint8Array): CategoryItem {
            return CategoryItem.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 UnimplementedCategoryService {
        static definition = {
            Fetch: {
                path: "/mall.Category/Fetch",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: CategoryFetchRequest) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => CategoryFetchRequest.deserialize(new Uint8Array(bytes)),
                responseSerialize: (message: CategoryReply) => Buffer.from(message.serialize()),
                responseDeserialize: (bytes: Buffer) => CategoryReply.deserialize(new Uint8Array(bytes))
            },
            Create: {
                path: "/mall.Category/Create",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: CategoryItem) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => CategoryItem.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.Category/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))
            },
            Modify: {
                path: "/mall.Category/Modify",
                requestStream: false,
                responseStream: false,
                requestSerialize: (message: CategoryItem) => Buffer.from(message.serialize()),
                requestDeserialize: (bytes: Buffer) => CategoryItem.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 Fetch(call: grpc_1.ServerUnaryCall<CategoryFetchRequest, CategoryReply>, callback: grpc_1.sendUnaryData<CategoryReply>): void;
        abstract Create(call: grpc_1.ServerUnaryCall<CategoryItem, 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;
        abstract Modify(call: grpc_1.ServerUnaryCall<CategoryItem, dependency_1.mall.StatusReply>, callback: grpc_1.sendUnaryData<dependency_1.mall.StatusReply>): void;
    }
    export class CategoryClient extends grpc_1.makeGenericClientConstructor(UnimplementedCategoryService.definition, "Category", {}) {
        constructor(address: string, credentials: grpc_1.ChannelCredentials, options?: Partial<grpc_1.ChannelOptions>) {
            super(address, credentials, options);
        }
        Fetch: GrpcUnaryServiceInterface<CategoryFetchRequest, CategoryReply> = (message: CategoryFetchRequest, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<CategoryReply>, options?: grpc_1.CallOptions | grpc_1.requestCallback<CategoryReply>, callback?: grpc_1.requestCallback<CategoryReply>): grpc_1.ClientUnaryCall => {
            return super.Fetch(message, metadata, options, callback);
        };
        Create: GrpcUnaryServiceInterface<CategoryItem, dependency_1.mall.StatusReply> = (message: CategoryItem, 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);
        };
        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);
        };
        Modify: GrpcUnaryServiceInterface<CategoryItem, dependency_1.mall.StatusReply> = (message: CategoryItem, 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);
        };
    }
}
