/*
  Warnings:

  - You are about to drop the column `cat_image` on the `Category` table. All the data in the column will be lost.
  - You are about to drop the column `cat_name` on the `Category` table. All the data in the column will be lost.
  - You are about to drop the column `translations` on the `Category` table. All the data in the column will be lost.
  - You are about to drop the column `imageId` on the `Service` table. All the data in the column will be lost.
  - You are about to drop the column `name` on the `Service` table. All the data in the column will be lost.
  - You are about to drop the column `subcatId` on the `Service` table. All the data in the column will be lost.
  - You are about to alter the column `status` on the `StaffAttendance` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(13))`.
  - Added the required column `cat_id` to the `Category` table without a default value. This is not possible if the table is not empty.
  - Added the required column `updatedAt` to the `ServiceGallery` table without a default value. This is not possible if the table is not empty.

*/
-- DropForeignKey
ALTER TABLE `Category` DROP FOREIGN KEY `Category_cat_image_fkey`;

-- DropForeignKey
ALTER TABLE `Service` DROP FOREIGN KEY `Service_catId_fkey`;

-- DropForeignKey
ALTER TABLE `Service` DROP FOREIGN KEY `Service_subcatId_fkey`;

-- DropForeignKey
ALTER TABLE `ServiceGallery` DROP FOREIGN KEY `ServiceGallery_serviceId_fkey`;

-- DropIndex
DROP INDEX `Category_cat_image_fkey` ON `Category`;

-- DropIndex
DROP INDEX `Service_catId_fkey` ON `Service`;

-- DropIndex
DROP INDEX `Service_subcatId_fkey` ON `Service`;

-- DropIndex
DROP INDEX `ServiceGallery_serviceId_fkey` ON `ServiceGallery`;

-- AlterTable
ALTER TABLE `Booking` ADD COLUMN `variationId` INTEGER NULL;

-- AlterTable
ALTER TABLE `Category` DROP COLUMN `cat_image`,
    DROP COLUMN `cat_name`,
    DROP COLUMN `translations`,
    ADD COLUMN `cat_id` INTEGER NOT NULL;

-- AlterTable
ALTER TABLE `Service` DROP COLUMN `imageId`,
    DROP COLUMN `name`,
    DROP COLUMN `subcatId`,
    ADD COLUMN `adminServiceId` INTEGER NULL,
    ADD COLUMN `status` BOOLEAN NOT NULL DEFAULT true;

-- AlterTable
ALTER TABLE `ServiceGallery` ADD COLUMN `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    ADD COLUMN `updatedAt` DATETIME(3) NOT NULL;

-- AlterTable
ALTER TABLE `StaffAttendance` ADD COLUMN `clockInIp` VARCHAR(191) NULL,
    ADD COLUMN `clockOutIp` VARCHAR(191) NULL,
    ADD COLUMN `lat` DOUBLE NULL,
    ADD COLUMN `lng` DOUBLE NULL,
    MODIFY `status` ENUM('PRESENT', 'LEFT') NOT NULL DEFAULT 'PRESENT';

-- CreateTable
CREATE TABLE `ParlourBanner` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `Banner_tittle` VARCHAR(191) NULL,
    `parlourId` INTEGER NOT NULL,
    `translations` JSON NOT NULL,
    `BannerImageId` INTEGER NULL,
    `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updatedAt` DATETIME(3) NOT NULL,

    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `ParlourKyc` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `parlourId` INTEGER NOT NULL,
    `kyc_tittle` VARCHAR(191) NULL,
    `translations` JSON NOT NULL,
    `kycImageId` INTEGER NULL,
    `documentNumber` VARCHAR(191) NULL,
    `issuedDate` DATETIME(3) NULL,
    `expiryDate` DATETIME(3) NULL,
    `panNumber` VARCHAR(191) NULL,
    `gstNumber` VARCHAR(191) NULL,
    `udyamNumber` VARCHAR(191) NULL,
    `businessType` VARCHAR(191) NULL,
    `addressProof` VARCHAR(191) NULL,
    `bankName` VARCHAR(191) NULL,
    `accountNumber` VARCHAR(191) NULL,
    `ifscCode` VARCHAR(191) NULL,
    `accountHolder` VARCHAR(191) NULL,
    `status` ENUM('pending', 'approved', 'rejected') NOT NULL DEFAULT 'pending',
    `remark` VARCHAR(191) NULL,
    `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updatedAt` DATETIME(3) NOT NULL,

    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `BusinessSetting` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `settingKey` VARCHAR(191) NOT NULL,
    `settingValue` DECIMAL(65, 30) NOT NULL,
    `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updatedAt` DATETIME(3) NOT NULL,

    UNIQUE INDEX `BusinessSetting_settingKey_key`(`settingKey`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `AdminCategory` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `name` VARCHAR(191) NOT NULL,
    `image` INTEGER NULL,
    `translations` JSON NOT NULL,
    `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updatedAt` DATETIME(3) NOT NULL,

    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `AdminServices` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `name` VARCHAR(191) NOT NULL,
    `translations` JSON NOT NULL,
    `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updatedAt` DATETIME(3) NOT NULL,
    `categoryId` INTEGER NOT NULL,

    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `Service` ADD CONSTRAINT `Service_catId_fkey` FOREIGN KEY (`catId`) REFERENCES `Category`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `Service` ADD CONSTRAINT `Service_adminServiceId_fkey` FOREIGN KEY (`adminServiceId`) REFERENCES `AdminServices`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `Booking` ADD CONSTRAINT `Booking_variationId_fkey` FOREIGN KEY (`variationId`) REFERENCES `ServiceVariation`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `Category` ADD CONSTRAINT `Category_cat_id_fkey` FOREIGN KEY (`cat_id`) REFERENCES `AdminCategory`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `ParlourBanner` ADD CONSTRAINT `ParlourBanner_BannerImageId_fkey` FOREIGN KEY (`BannerImageId`) REFERENCES `Media`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `ParlourBanner` ADD CONSTRAINT `ParlourBanner_parlourId_fkey` FOREIGN KEY (`parlourId`) REFERENCES `Parlour`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `ParlourKyc` ADD CONSTRAINT `ParlourKyc_kycImageId_fkey` FOREIGN KEY (`kycImageId`) REFERENCES `Media`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `ParlourKyc` ADD CONSTRAINT `ParlourKyc_parlourId_fkey` FOREIGN KEY (`parlourId`) REFERENCES `Parlour`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `AdminCategory` ADD CONSTRAINT `AdminCategory_image_fkey` FOREIGN KEY (`image`) REFERENCES `Media`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `AdminServices` ADD CONSTRAINT `AdminServices_categoryId_fkey` FOREIGN KEY (`categoryId`) REFERENCES `AdminCategory`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `ServiceGallery` ADD CONSTRAINT `ServiceGallery_serviceId_fkey` FOREIGN KEY (`serviceId`) REFERENCES `AdminServices`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `ServiceGallery` ADD CONSTRAINT `ServiceGallery_imageId_fkey` FOREIGN KEY (`imageId`) REFERENCES `Media`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
