-- AlterTable
ALTER TABLE `users` ADD COLUMN `address` VARCHAR(500) NULL,
    ADD COLUMN `alternate_phone` VARCHAR(15) NULL,
    ADD COLUMN `city` VARCHAR(80) NULL,
    ADD COLUMN `date_of_birth` DATE NULL,
    ADD COLUMN `designation` VARCHAR(80) NULL,
    ADD COLUMN `gender` ENUM('MALE', 'FEMALE', 'OTHER', 'PREFER_NOT_TO_SAY') NULL,
    ADD COLUMN `language` VARCHAR(10) NOT NULL DEFAULT 'en',
    ADD COLUMN `pincode` VARCHAR(10) NULL,
    ADD COLUMN `profile_image_url` VARCHAR(500) NULL,
    ADD COLUMN `state` VARCHAR(80) NULL;

-- CreateTable
CREATE TABLE `dealer_profiles` (
    `id` VARCHAR(191) NOT NULL,
    `user_id` VARCHAR(191) NOT NULL,
    `shop_name` VARCHAR(120) NULL,
    `dealer_code` VARCHAR(32) NULL,
    `gst_number` VARCHAR(20) NULL,
    `business_email` VARCHAR(120) NULL,
    `business_phone` VARCHAR(15) NULL,
    `website` VARCHAR(200) NULL,
    `shop_image_url` VARCHAR(500) NULL,
    `available_days` JSON NULL,
    `available_time_from` VARCHAR(8) NULL,
    `available_time_to` VARCHAR(8) NULL,
    `years_of_experience` INTEGER NULL,
    `description` TEXT NULL,
    `is_verified` BOOLEAN NOT NULL DEFAULT false,
    `verification_status` ENUM('NONE', 'PENDING', 'APPROVED', 'REJECTED') NOT NULL DEFAULT 'NONE',
    `government_id_type` ENUM('AADHAAR', 'PAN', 'DRIVING_LICENSE', 'VOTER_ID', 'PASSPORT') NULL,
    `government_id_url` VARCHAR(500) NULL,
    `verification_note` VARCHAR(255) NULL,
    `verified_at` DATETIME(3) NULL,
    `created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updated_at` DATETIME(3) NOT NULL,

    UNIQUE INDEX `dealer_profiles_user_id_key`(`user_id`),
    UNIQUE INDEX `dealer_profiles_dealer_code_key`(`dealer_code`),
    PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `dealer_profiles` ADD CONSTRAINT `dealer_profiles_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
