"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.productReviews = exports.banners = exports.clientReviews = exports.orderItems = exports.orders = exports.mediaAssets = exports.productOccasions = exports.productLensFeatures = exports.productFaceShapes = exports.productGenders = exports.products = exports.priceRanges = exports.sizes = exports.ageGroups = exports.lensFeatures = exports.frameColors = exports.genders = exports.faceShapes = exports.frameShapes = exports.occasions = exports.collections = exports.productTypes = exports.brands = exports.authOtps = exports.authSessions = exports.staffUsers = exports.customers = exports.paymentStatusValues = exports.paymentMethodValues = exports.orderStatusValues = exports.fulfillmentMethodValues = exports.mediaOwnerTypeValues = exports.productStatusValues = exports.otpPurposeValues = exports.otpActorTypeValues = exports.staffRoleValues = void 0;
const mysql_core_1 = require("drizzle-orm/mysql-core");
const id = () => (0, mysql_core_1.int)("id", { unsigned: true }).autoincrement().primaryKey();
const createdAt = () => (0, mysql_core_1.timestamp)("created_at").defaultNow().notNull();
const updatedAt = () => (0, mysql_core_1.timestamp)("updated_at").defaultNow().onUpdateNow().notNull();
exports.staffRoleValues = ["seller", "admin"];
exports.otpActorTypeValues = ["customer", "staff"];
exports.otpPurposeValues = ["signup", "login", "password_reset"];
exports.productStatusValues = [
    "draft",
    "active",
    "archived",
    "out_of_stock",
];
exports.mediaOwnerTypeValues = [
    "product",
    "brand",
    "product_type",
    "collection",
    "frame_shape",
    "review",
    "staff",
    "customer",
];
exports.fulfillmentMethodValues = ["pickup", "delivery"];
exports.orderStatusValues = [
    "pending",
    "confirmed",
    "processing",
    "ready_for_pickup",
    "out_for_delivery",
    "completed",
    "cancelled",
    "refunded",
];
exports.paymentMethodValues = [
    "cash_on_delivery",
    "online",
    "bank_transfer",
];
exports.paymentStatusValues = [
    "pending",
    "paid",
    "failed",
    "refunded",
];
exports.customers = (0, mysql_core_1.mysqlTable)("customers", {
    id: id(),
    email: (0, mysql_core_1.varchar)("email", { length: 255 }).notNull(),
    name: (0, mysql_core_1.varchar)("name", { length: 255 }),
    phoneNumber: (0, mysql_core_1.varchar)("phone_number", { length: 30 }),
    emailVerifiedAt: (0, mysql_core_1.timestamp)("email_verified_at"),
    lastLoginAt: (0, mysql_core_1.timestamp)("last_login_at"),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [
    (0, mysql_core_1.uniqueIndex)("customers_email_unique").on(table.email),
    (0, mysql_core_1.uniqueIndex)("customers_phone_number_unique").on(table.phoneNumber),
]);
exports.staffUsers = (0, mysql_core_1.mysqlTable)("staff_users", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 255 }).notNull(),
    email: (0, mysql_core_1.varchar)("email", { length: 255 }).notNull(),
    passwordHash: (0, mysql_core_1.varchar)("password_hash", { length: 255 }).notNull(),
    role: (0, mysql_core_1.mysqlEnum)("role", exports.staffRoleValues).notNull().default("seller"),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    emailVerifiedAt: (0, mysql_core_1.timestamp)("email_verified_at"),
    lastLoginAt: (0, mysql_core_1.timestamp)("last_login_at"),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("staff_users_email_unique").on(table.email)]);
exports.authSessions = (0, mysql_core_1.mysqlTable)("auth_sessions", {
    id: id(),
    actorType: (0, mysql_core_1.mysqlEnum)("actor_type", exports.otpActorTypeValues).notNull(),
    actorId: (0, mysql_core_1.int)("actor_id", { unsigned: true }).notNull(),
    refreshTokenHash: (0, mysql_core_1.varchar)("refresh_token_hash", { length: 255 }).notNull(),
    userAgent: (0, mysql_core_1.varchar)("user_agent", { length: 512 }),
    ipAddress: (0, mysql_core_1.varchar)("ip_address", { length: 80 }),
    expiresAt: (0, mysql_core_1.timestamp)("expires_at").notNull(),
    revokedAt: (0, mysql_core_1.timestamp)("revoked_at"),
    lastUsedAt: (0, mysql_core_1.timestamp)("last_used_at"),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [
    (0, mysql_core_1.uniqueIndex)("auth_sessions_refresh_token_hash_unique").on(table.refreshTokenHash),
    (0, mysql_core_1.index)("auth_sessions_actor_idx").on(table.actorType, table.actorId),
    (0, mysql_core_1.index)("auth_sessions_expires_idx").on(table.expiresAt),
]);
exports.authOtps = (0, mysql_core_1.mysqlTable)("auth_otps", {
    id: id(),
    actorType: (0, mysql_core_1.mysqlEnum)("actor_type", exports.otpActorTypeValues).notNull(),
    email: (0, mysql_core_1.varchar)("email", { length: 255 }).notNull(),
    codeHash: (0, mysql_core_1.varchar)("code_hash", { length: 255 }).notNull(),
    purpose: (0, mysql_core_1.mysqlEnum)("purpose", exports.otpPurposeValues).notNull().default("login"),
    attempts: (0, mysql_core_1.int)("attempts", { unsigned: true }).notNull().default(0),
    expiresAt: (0, mysql_core_1.timestamp)("expires_at").notNull(),
    consumedAt: (0, mysql_core_1.timestamp)("consumed_at"),
    createdAt: createdAt(),
}, (table) => [
    (0, mysql_core_1.index)("auth_otps_email_idx").on(table.email),
    (0, mysql_core_1.index)("auth_otps_lookup_idx").on(table.actorType, table.email, table.purpose),
]);
exports.brands = (0, mysql_core_1.mysqlTable)("brands", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 120 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 140 }).notNull(),
    description: (0, mysql_core_1.text)("description"),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("brands_slug_unique").on(table.slug)]);
exports.productTypes = (0, mysql_core_1.mysqlTable)("product_types", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 120 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 140 }).notNull(),
    description: (0, mysql_core_1.text)("description"),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("product_types_slug_unique").on(table.slug)]);
exports.collections = (0, mysql_core_1.mysqlTable)("collections", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 120 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 140 }).notNull(),
    description: (0, mysql_core_1.text)("description"),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("collections_slug_unique").on(table.slug)]);
exports.occasions = (0, mysql_core_1.mysqlTable)("occasions", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 120 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 140 }).notNull(),
    description: (0, mysql_core_1.text)("description"),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("occasions_slug_unique").on(table.slug)]);
exports.frameShapes = (0, mysql_core_1.mysqlTable)("frame_shapes", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 120 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 140 }).notNull(),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("frame_shapes_slug_unique").on(table.slug)]);
exports.faceShapes = (0, mysql_core_1.mysqlTable)("face_shapes", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 120 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 140 }).notNull(),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("face_shapes_slug_unique").on(table.slug)]);
exports.genders = (0, mysql_core_1.mysqlTable)("genders", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 80 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 100 }).notNull(),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("genders_slug_unique").on(table.slug)]);
exports.frameColors = (0, mysql_core_1.mysqlTable)("frame_colors", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 80 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 100 }).notNull(),
    hexCode: (0, mysql_core_1.varchar)("hex_code", { length: 7 }),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("frame_colors_slug_unique").on(table.slug)]);
exports.lensFeatures = (0, mysql_core_1.mysqlTable)("lens_features", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 140 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 160 }).notNull(),
    description: (0, mysql_core_1.text)("description"),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("lens_features_slug_unique").on(table.slug)]);
exports.ageGroups = (0, mysql_core_1.mysqlTable)("age_groups", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 80 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 100 }).notNull(),
    minAge: (0, mysql_core_1.int)("min_age", { unsigned: true }),
    maxAge: (0, mysql_core_1.int)("max_age", { unsigned: true }),
    sortOrder: (0, mysql_core_1.int)("sort_order", { unsigned: true }).notNull().default(0),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("age_groups_slug_unique").on(table.slug)]);
exports.sizes = (0, mysql_core_1.mysqlTable)("sizes", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 20 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 40 }).notNull(),
    sortOrder: (0, mysql_core_1.int)("sort_order", { unsigned: true }).notNull().default(0),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("sizes_slug_unique").on(table.slug)]);
exports.priceRanges = (0, mysql_core_1.mysqlTable)("price_ranges", {
    id: id(),
    name: (0, mysql_core_1.varchar)("name", { length: 120 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 140 }).notNull(),
    minPrice: (0, mysql_core_1.int)("min_price", { unsigned: true }).notNull(),
    maxPrice: (0, mysql_core_1.int)("max_price", { unsigned: true }),
    sortOrder: (0, mysql_core_1.int)("sort_order", { unsigned: true }).notNull().default(0),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [(0, mysql_core_1.uniqueIndex)("price_ranges_slug_unique").on(table.slug)]);
exports.products = (0, mysql_core_1.mysqlTable)("products", {
    id: id(),
    sku: (0, mysql_core_1.varchar)("sku", { length: 80 }).notNull(),
    name: (0, mysql_core_1.varchar)("name", { length: 255 }).notNull(),
    slug: (0, mysql_core_1.varchar)("slug", { length: 280 }).notNull(),
    description: (0, mysql_core_1.text)("description"),
    brandId: (0, mysql_core_1.int)("brand_id", { unsigned: true }).references(() => exports.brands.id),
    productTypeId: (0, mysql_core_1.int)("product_type_id", { unsigned: true }).references(() => exports.productTypes.id),
    collectionId: (0, mysql_core_1.int)("collection_id", { unsigned: true }).references(() => exports.collections.id),
    frameShapeId: (0, mysql_core_1.int)("frame_shape_id", { unsigned: true }).references(() => exports.frameShapes.id),
    frameColorId: (0, mysql_core_1.int)("frame_color_id", { unsigned: true }).references(() => exports.frameColors.id),
    ageGroupId: (0, mysql_core_1.int)("age_group_id", { unsigned: true }).references(() => exports.ageGroups.id),
    sizeId: (0, mysql_core_1.int)("size_id", { unsigned: true }).references(() => exports.sizes.id),
    basePrice: (0, mysql_core_1.int)("base_price", { unsigned: true }).notNull(),
    discountPercent: (0, mysql_core_1.int)("discount_percent", { unsigned: true })
        .notNull()
        .default(0),
    salePrice: (0, mysql_core_1.int)("sale_price", { unsigned: true }).notNull(),
    stockQuantity: (0, mysql_core_1.int)("stock_quantity", { unsigned: true })
        .notNull()
        .default(0),
    status: (0, mysql_core_1.mysqlEnum)("status", exports.productStatusValues).notNull().default("draft"),
    isFeatured: (0, mysql_core_1.boolean)("is_featured").notNull().default(false),
    averageRating: (0, mysql_core_1.decimal)("average_rating", { precision: 3, scale: 2 })
        .notNull()
        .default("0.00"),
    ratingCount: (0, mysql_core_1.int)("rating_count", { unsigned: true }).notNull().default(0),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [
    (0, mysql_core_1.uniqueIndex)("products_sku_unique").on(table.sku),
    (0, mysql_core_1.uniqueIndex)("products_slug_unique").on(table.slug),
    (0, mysql_core_1.index)("products_brand_idx").on(table.brandId),
    (0, mysql_core_1.index)("products_product_type_idx").on(table.productTypeId),
    (0, mysql_core_1.index)("products_collection_idx").on(table.collectionId),
    (0, mysql_core_1.index)("products_price_idx").on(table.salePrice),
    (0, mysql_core_1.index)("products_status_idx").on(table.status),
    (0, mysql_core_1.index)("products_status_price_idx").on(table.status, table.salePrice),
    (0, mysql_core_1.index)("products_status_created_idx").on(table.status, table.createdAt),
    (0, mysql_core_1.index)("products_status_rating_idx").on(table.status, table.averageRating, table.ratingCount),
    (0, mysql_core_1.index)("products_status_featured_idx").on(table.status, table.isFeatured),
]);
exports.productGenders = (0, mysql_core_1.mysqlTable)("product_genders", {
    productId: (0, mysql_core_1.int)("product_id", { unsigned: true })
        .notNull()
        .references(() => exports.products.id),
    genderId: (0, mysql_core_1.int)("gender_id", { unsigned: true })
        .notNull()
        .references(() => exports.genders.id),
}, (table) => [(0, mysql_core_1.primaryKey)({ columns: [table.productId, table.genderId] })]);
exports.productFaceShapes = (0, mysql_core_1.mysqlTable)("product_face_shapes", {
    productId: (0, mysql_core_1.int)("product_id", { unsigned: true })
        .notNull()
        .references(() => exports.products.id),
    faceShapeId: (0, mysql_core_1.int)("face_shape_id", { unsigned: true })
        .notNull()
        .references(() => exports.faceShapes.id),
}, (table) => [(0, mysql_core_1.primaryKey)({ columns: [table.productId, table.faceShapeId] })]);
exports.productLensFeatures = (0, mysql_core_1.mysqlTable)("product_lens_features", {
    productId: (0, mysql_core_1.int)("product_id", { unsigned: true })
        .notNull()
        .references(() => exports.products.id),
    lensFeatureId: (0, mysql_core_1.int)("lens_feature_id", { unsigned: true })
        .notNull()
        .references(() => exports.lensFeatures.id),
}, (table) => [(0, mysql_core_1.primaryKey)({ columns: [table.productId, table.lensFeatureId] })]);
exports.productOccasions = (0, mysql_core_1.mysqlTable)("product_occasions", {
    productId: (0, mysql_core_1.int)("product_id", { unsigned: true })
        .notNull()
        .references(() => exports.products.id),
    occasionId: (0, mysql_core_1.int)("occasion_id", { unsigned: true })
        .notNull()
        .references(() => exports.occasions.id),
}, (table) => [(0, mysql_core_1.primaryKey)({ columns: [table.productId, table.occasionId] })]);
exports.mediaAssets = (0, mysql_core_1.mysqlTable)("media_assets", {
    id: id(),
    ownerType: (0, mysql_core_1.mysqlEnum)("owner_type", exports.mediaOwnerTypeValues).notNull(),
    ownerId: (0, mysql_core_1.int)("owner_id", { unsigned: true }).notNull(),
    url: (0, mysql_core_1.varchar)("url", { length: 512 }).notNull(),
    storageKey: (0, mysql_core_1.varchar)("storage_key", { length: 1024 }),
    fileName: (0, mysql_core_1.varchar)("file_name", { length: 255 }),
    mimeType: (0, mysql_core_1.varchar)("mime_type", { length: 120 }),
    sizeBytes: (0, mysql_core_1.int)("size_bytes", { unsigned: true }),
    altText: (0, mysql_core_1.varchar)("alt_text", { length: 255 }),
    sortOrder: (0, mysql_core_1.int)("sort_order", { unsigned: true }).notNull().default(0),
    isPrimary: (0, mysql_core_1.boolean)("is_primary").notNull().default(false),
    uploadedByStaffId: (0, mysql_core_1.int)("uploaded_by_staff_id", {
        unsigned: true,
    }).references(() => exports.staffUsers.id),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [
    (0, mysql_core_1.uniqueIndex)("media_assets_owner_url_unique").on(table.ownerType, table.ownerId, table.url),
    (0, mysql_core_1.index)("media_assets_owner_idx").on(table.ownerType, table.ownerId),
    (0, mysql_core_1.index)("media_assets_uploaded_by_staff_idx").on(table.uploadedByStaffId),
]);
exports.orders = (0, mysql_core_1.mysqlTable)("orders", {
    id: id(),
    orderNumber: (0, mysql_core_1.varchar)("order_number", { length: 40 }).notNull(),
    customerId: (0, mysql_core_1.int)("customer_id", { unsigned: true })
        .notNull()
        .references(() => exports.customers.id),
    managedByStaffId: (0, mysql_core_1.int)("managed_by_staff_id", { unsigned: true }).references(() => exports.staffUsers.id),
    status: (0, mysql_core_1.mysqlEnum)("status", exports.orderStatusValues).notNull().default("pending"),
    fulfillmentMethod: (0, mysql_core_1.mysqlEnum)("fulfillment_method", exports.fulfillmentMethodValues).notNull(),
    contactPhone: (0, mysql_core_1.varchar)("contact_phone", { length: 30 }).notNull(),
    deliveryAddress: (0, mysql_core_1.text)("delivery_address"),
    subtotal: (0, mysql_core_1.int)("subtotal", { unsigned: true }).notNull(),
    totalDiscount: (0, mysql_core_1.int)("total_discount", { unsigned: true })
        .notNull()
        .default(0),
    totalAmount: (0, mysql_core_1.int)("total_amount", { unsigned: true }).notNull(),
    paymentMethod: (0, mysql_core_1.mysqlEnum)("payment_method", exports.paymentMethodValues)
        .notNull()
        .default("cash_on_delivery"),
    paymentStatus: (0, mysql_core_1.mysqlEnum)("payment_status", exports.paymentStatusValues)
        .notNull()
        .default("pending"),
    customerNotes: (0, mysql_core_1.text)("customer_notes"),
    staffNotes: (0, mysql_core_1.text)("staff_notes"),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [
    (0, mysql_core_1.uniqueIndex)("orders_order_number_unique").on(table.orderNumber),
    (0, mysql_core_1.index)("orders_customer_idx").on(table.customerId),
    (0, mysql_core_1.index)("orders_status_idx").on(table.status),
    (0, mysql_core_1.index)("orders_managed_by_staff_idx").on(table.managedByStaffId),
    (0, mysql_core_1.index)("orders_created_idx").on(table.createdAt),
    (0, mysql_core_1.index)("orders_status_created_idx").on(table.status, table.createdAt),
    (0, mysql_core_1.index)("orders_payment_status_created_idx").on(table.paymentStatus, table.createdAt),
    (0, mysql_core_1.index)("orders_fulfillment_created_idx").on(table.fulfillmentMethod, table.createdAt),
]);
exports.orderItems = (0, mysql_core_1.mysqlTable)("order_items", {
    id: id(),
    orderId: (0, mysql_core_1.int)("order_id", { unsigned: true })
        .notNull()
        .references(() => exports.orders.id),
    productId: (0, mysql_core_1.int)("product_id", { unsigned: true }).references(() => exports.products.id),
    productName: (0, mysql_core_1.varchar)("product_name", { length: 255 }).notNull(),
    sku: (0, mysql_core_1.varchar)("sku", { length: 80 }).notNull(),
    quantity: (0, mysql_core_1.int)("quantity", { unsigned: true }).notNull(),
    unitPrice: (0, mysql_core_1.int)("unit_price", { unsigned: true }).notNull(),
    discountAmount: (0, mysql_core_1.int)("discount_amount", { unsigned: true })
        .notNull()
        .default(0),
    lineTotal: (0, mysql_core_1.int)("line_total", { unsigned: true }).notNull(),
    lensChoice: (0, mysql_core_1.varchar)("lens_choice", { length: 30 })
        .notNull()
        .default("none"),
    prescriptionUrl: (0, mysql_core_1.varchar)("prescription_url", { length: 500 }),
    createdAt: createdAt(),
}, (table) => [
    (0, mysql_core_1.uniqueIndex)("order_items_order_sku_unique").on(table.orderId, table.sku),
    (0, mysql_core_1.index)("order_items_order_idx").on(table.orderId),
    (0, mysql_core_1.index)("order_items_product_idx").on(table.productId),
]);
exports.clientReviews = (0, mysql_core_1.mysqlTable)("client_reviews", {
    id: id(),
    clientName: (0, mysql_core_1.varchar)("client_name", { length: 255 }).notNull(),
    reviewText: (0, mysql_core_1.text)("review_text").notNull(),
    postUrl: (0, mysql_core_1.varchar)("post_url", { length: 1024 }),
    starRating: (0, mysql_core_1.int)("star_rating", { unsigned: true }).notNull().default(5),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    sortOrder: (0, mysql_core_1.int)("sort_order", { unsigned: true }).notNull().default(0),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [
    (0, mysql_core_1.index)("client_reviews_active_sort_idx").on(table.isActive, table.sortOrder),
]);
exports.banners = (0, mysql_core_1.mysqlTable)("banners", {
    id: id(),
    title: (0, mysql_core_1.varchar)("title", { length: 255 }).notNull(),
    subtitle: (0, mysql_core_1.varchar)("subtitle", { length: 255 }),
    imageUrl: (0, mysql_core_1.varchar)("image_url", { length: 512 }).notNull(),
    linkUrl: (0, mysql_core_1.varchar)("link_url", { length: 512 }),
    linkLabel: (0, mysql_core_1.varchar)("link_label", { length: 120 }),
    isActive: (0, mysql_core_1.boolean)("is_active").notNull().default(true),
    sortOrder: (0, mysql_core_1.int)("sort_order", { unsigned: true }).notNull().default(0),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [
    (0, mysql_core_1.index)("banners_active_sort_idx").on(table.isActive, table.sortOrder),
]);
exports.productReviews = (0, mysql_core_1.mysqlTable)("product_reviews", {
    id: id(),
    productId: (0, mysql_core_1.int)("product_id", { unsigned: true })
        .notNull()
        .references(() => exports.products.id),
    customerId: (0, mysql_core_1.int)("customer_id", { unsigned: true })
        .notNull()
        .references(() => exports.customers.id),
    rating: (0, mysql_core_1.int)("rating", { unsigned: true }).notNull(),
    title: (0, mysql_core_1.varchar)("title", { length: 160 }),
    comment: (0, mysql_core_1.text)("comment"),
    isApproved: (0, mysql_core_1.boolean)("is_approved").notNull().default(false),
    createdAt: createdAt(),
    updatedAt: updatedAt(),
}, (table) => [
    (0, mysql_core_1.uniqueIndex)("product_reviews_customer_product_unique").on(table.productId, table.customerId),
    (0, mysql_core_1.index)("product_reviews_product_idx").on(table.productId),
    (0, mysql_core_1.index)("product_reviews_customer_idx").on(table.customerId),
]);
//# sourceMappingURL=schema.js.map