"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Shop = void 0;
const typeorm_1 = require("typeorm");
const status_enum_1 = require("../columntype/status.enum");
const category_entity_1 = require("../category/category.entity");
const service_entity_1 = require("../service/service.entity");
const slugify_1 = require("slugify");
const shopcontact_entity_1 = require("../shopcontact/shopcontact.entity");
const schedule_entity_1 = require("../schedule/schedule.entity");
const review_entity_1 = require("../review/review.entity");
const highlight_entity_1 = require("../highlight/highlight.entity");
const user_entity_1 = require("../vendor/user.entity");
let Shop = class Shop {
    generateSlug() {
        if (this.name) {
            this.slug = (0, slugify_1.default)(this.name, { lower: true });
        }
    }
};
exports.Shop = Shop;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)(),
    __metadata("design:type", Number)
], Shop.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)(),
    __metadata("design:type", String)
], Shop.prototype, "name", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, charset: 'utf8mb4', collation: 'utf8mb4_general_ci' }),
    __metadata("design:type", String)
], Shop.prototype, "name_urd", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, charset: 'utf8mb4', collation: 'utf8mb4_general_ci' }),
    __metadata("design:type", String)
], Shop.prototype, "name_ar", void 0);
__decorate([
    (0, typeorm_1.Column)({ unique: true }),
    __metadata("design:type", String)
], Shop.prototype, "slug", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => user_entity_1.User, (user) => user.shops, { onDelete: 'CASCADE' }),
    (0, typeorm_1.JoinColumn)({ name: 'userId' }),
    __metadata("design:type", user_entity_1.User)
], Shop.prototype, "user", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'bigint', nullable: true }),
    __metadata("design:type", Number)
], Shop.prototype, "userId", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true }),
    __metadata("design:type", String)
], Shop.prototype, "address", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, charset: 'utf8mb4', collation: 'utf8mb4_general_ci' }),
    __metadata("design:type", String)
], Shop.prototype, "address_urd", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, charset: 'utf8mb4', collation: 'utf8mb4_general_ci' }),
    __metadata("design:type", String)
], Shop.prototype, "address_ar", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true }),
    __metadata("design:type", String)
], Shop.prototype, "map_address", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, charset: 'utf8mb4', collation: 'utf8mb4_general_ci' }),
    __metadata("design:type", String)
], Shop.prototype, "city", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true }),
    __metadata("design:type", String)
], Shop.prototype, "latitude", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true }),
    __metadata("design:type", String)
], Shop.prototype, "longitude", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true }),
    __metadata("design:type", String)
], Shop.prototype, "description", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, charset: 'utf8mb4', collation: 'utf8mb4_general_ci' }),
    __metadata("design:type", String)
], Shop.prototype, "description_urd", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, charset: 'utf8mb4', collation: 'utf8mb4_general_ci' }),
    __metadata("design:type", String)
], Shop.prototype, "description_ar", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'tinyint', width: 1, default: 0 }),
    __metadata("design:type", Number)
], Shop.prototype, "is_featured", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'tinyint', width: 1, default: 0 }),
    __metadata("design:type", Number)
], Shop.prototype, "quick_response", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, }),
    __metadata("design:type", String)
], Shop.prototype, "business_year", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, }),
    __metadata("design:type", String)
], Shop.prototype, "shop_featured", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, }),
    __metadata("design:type", String)
], Shop.prototype, "logo", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, }),
    __metadata("design:type", String)
], Shop.prototype, "image", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, }),
    __metadata("design:type", String)
], Shop.prototype, "video", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true, }),
    __metadata("design:type", String)
], Shop.prototype, "videothamnail", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: 'text', nullable: true, }),
    __metadata("design:type", String)
], Shop.prototype, "galleries", void 0);
__decorate([
    (0, typeorm_1.Column)({ default: status_enum_1.Status.INACTIVE, type: "enum", enum: status_enum_1.Status }),
    __metadata("design:type", String)
], Shop.prototype, "status", void 0);
__decorate([
    (0, typeorm_1.CreateDateColumn)(),
    __metadata("design:type", Date)
], Shop.prototype, "createdAt", void 0);
__decorate([
    (0, typeorm_1.UpdateDateColumn)(),
    __metadata("design:type", Date)
], Shop.prototype, "updatedAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true }),
    __metadata("design:type", Number)
], Shop.prototype, "categoryId", void 0);
__decorate([
    (0, typeorm_1.ManyToOne)(() => category_entity_1.Category, (category) => category.shops, { onDelete: 'CASCADE' }),
    __metadata("design:type", category_entity_1.Category)
], Shop.prototype, "category", void 0);
__decorate([
    (0, typeorm_1.OneToMany)(() => service_entity_1.Service, (service) => service.shop, { cascade: true }),
    __metadata("design:type", Array)
], Shop.prototype, "services", void 0);
__decorate([
    (0, typeorm_1.OneToOne)(() => shopcontact_entity_1.ShopContact, (contact) => contact.shop, { cascade: true, eager: true }),
    (0, typeorm_1.JoinColumn)(),
    __metadata("design:type", shopcontact_entity_1.ShopContact)
], Shop.prototype, "contact", void 0);
__decorate([
    (0, typeorm_1.OneToMany)(() => schedule_entity_1.Schedule, (schedule) => schedule.shop, { cascade: true }),
    __metadata("design:type", Array)
], Shop.prototype, "schedules", void 0);
__decorate([
    (0, typeorm_1.OneToMany)(() => review_entity_1.Review, (review) => review.shop, { cascade: true }),
    __metadata("design:type", Array)
], Shop.prototype, "reviews", void 0);
__decorate([
    (0, typeorm_1.OneToMany)(() => highlight_entity_1.Highlight, (highlight) => highlight.shop, { cascade: true }),
    __metadata("design:type", Array)
], Shop.prototype, "highlights", void 0);
__decorate([
    (0, typeorm_1.BeforeInsert)(),
    (0, typeorm_1.BeforeUpdate)(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], Shop.prototype, "generateSlug", null);
exports.Shop = Shop = __decorate([
    (0, typeorm_1.Entity)("shops")
], Shop);
//# sourceMappingURL=shop.entity.js.map