CREATE TABLE IF NOT EXISTS `poi_settings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `org_id` varchar(50) NOT NULL,
  `release_enabled` tinyint(1) NOT NULL DEFAULT 0,
  `payroll_from_month` varchar(20) NOT NULL DEFAULT 'March',
  `allow_switch_tax_regime` tinyint(1) NOT NULL DEFAULT 1,
  `allow_tds_modification` tinyint(1) NOT NULL DEFAULT 0,
  `mandate_attachments` tinyint(1) NOT NULL DEFAULT 0,
  `mandate_reviewer_comments` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq_poi_org` (`org_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `poi_submissions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `org_id` varchar(50) NOT NULL,
  `employee_id` int(11) NOT NULL,
  `fiscal_year` varchar(20) NOT NULL,
  `tax_regime` varchar(40) NOT NULL DEFAULT 'Old Tax Regime',
  `investment_name` varchar(150) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `status` enum('pending','submitted','approved') NOT NULL DEFAULT 'pending',
  `declared_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `approved_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `submitted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_poi_employee` (`employee_id`),
  KEY `idx_poi_status` (`status`),
  KEY `idx_poi_year` (`fiscal_year`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
