-- New fields for customer_applications from Page 1
ALTER TABLE `customer_applications` ADD COLUMN `fax` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `customer_applications` ADD COLUMN `gst_reg_no` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `customer_applications` ADD COLUMN `company_reg_no` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `customer_applications` ADD COLUMN `date_of_incorporation` DATE DEFAULT NULL;
ALTER TABLE `customer_applications` ADD COLUMN `country_of_incorporation` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `customer_applications` ADD COLUMN `contact_person_designation` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `customer_applications` ADD COLUMN `credit_terms` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `customer_applications` ADD COLUMN `account_setup_ar_statement` BOOLEAN DEFAULT FALSE;
ALTER TABLE `customer_applications` ADD COLUMN `account_setup_dunning_letter` BOOLEAN DEFAULT FALSE;
ALTER TABLE `customer_applications` ADD COLUMN `account_setup_ap_payment` BOOLEAN DEFAULT FALSE;

-- New table for shareholder/director information from Page 2
CREATE TABLE IF NOT EXISTS `shareholder_director_information` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `application_id` INT NOT NULL,
  `name` VARCHAR(255) DEFAULT NULL,
  `address` TEXT DEFAULT NULL,
  `perc_of_shareholding` VARCHAR(255) DEFAULT NULL,
  `contact_no` VARCHAR(255) DEFAULT NULL,
  FOREIGN KEY (`application_id`) REFERENCES `customer_applications`(`id`) ON DELETE CASCADE
);

-- New fields for customer_trade_references from Page 2
ALTER TABLE `customer_trade_references` ADD COLUMN `telephone_no` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `customer_trade_references` ADD COLUMN `fax_no` VARCHAR(255) DEFAULT NULL;

-- New fields for banker's information from Page 3
ALTER TABLE `customer_bank_details` ADD COLUMN `address` TEXT DEFAULT NULL;
ALTER TABLE `customer_bank_details` ADD COLUMN `swift_code` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `customer_bank_details` ADD COLUMN `contact_person` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `customer_bank_details` ADD COLUMN `telephone_no` VARCHAR(255) DEFAULT NULL;
ALTER TABLE `customer_bank_details` ADD COLUMN `fax_no` VARCHAR(255) DEFAULT NULL;


-- New table for financial information from Page 3
CREATE TABLE IF NOT EXISTS `customer_financial_information` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `customer_application_id` INT NOT NULL,
  `latest_audited_financial_year` VARCHAR(255) DEFAULT NULL,
  `shareholder_equity` VARCHAR(255) DEFAULT NULL,
  `paid_up_capital` VARCHAR(255) DEFAULT NULL,
  `annual_turnover` VARCHAR(255) DEFAULT NULL,
  `net_profit_loss` VARCHAR(255) DEFAULT NULL,
  `currency` VARCHAR(50) DEFAULT NULL,
   FOREIGN KEY (`customer_application_id`) REFERENCES `customer_applications`(`id`) ON DELETE CASCADE
);

-- Declaration and Authorisation from Page 3
ALTER TABLE `customer_applications` ADD COLUMN `declaration_name` TEXT DEFAULT NULL;
ALTER TABLE `customer_applications` ADD COLUMN `declaration_designation` TEXT DEFAULT NULL;
ALTER TABLE `customer_applications` ADD COLUMN `declaration_date` DATE DEFAULT NULL;
