USE `skillst1_rngkqnhl_printportal`;

CREATE TABLE IF NOT EXISTS `staff_profiles` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `user_id` INT NOT NULL UNIQUE,
  `employee_code` VARCHAR(50) NOT NULL UNIQUE,
  `designation` VARCHAR(100) NULL,
  `department` VARCHAR(100) NULL,
  `joining_date` DATE NULL,
  `dob` DATE NULL,
  `address` TEXT NULL,
  `photo` VARCHAR(255) NULL,
  `id_card_valid_upto` DATE NULL,
  `emergency_contact` VARCHAR(30) NULL,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  INDEX (`user_id`)
);

CREATE TABLE IF NOT EXISTS `staff_documents` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `user_id` INT NOT NULL,
  `document_type` ENUM('JOINING_LETTER','ID_CARD') NOT NULL,
  `document_no` VARCHAR(80) NULL,
  `issue_date` DATE NULL,
  `file_path` VARCHAR(255) NULL,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  INDEX (`user_id`)
);
