-- Global Tables Schema
-- These tables are not business-specific and are used across all businesses

SET FOREIGN_KEY_CHECKS = 0;

-- Table for storing country-specific denominations
CREATE TABLE IF NOT EXISTS `default_country_denominations` (
    `id` BIGINT PRIMARY KEY AUTO_INCREMENT,
    `country_code` VARCHAR(3) NOT NULL,
    `currency_code` VARCHAR(3) NOT NULL,
    `currency_symbol` VARCHAR(5) NOT NULL,
    `denomination_value` DECIMAL(10,2) NOT NULL,
    `is_coin` BOOLEAN DEFAULT FALSE,
    `is_active` BOOLEAN DEFAULT TRUE,
    `display_order` INT NOT NULL,
    `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    UNIQUE KEY `idx_country_denom` (`country_code`, `denomination_value`),
    INDEX `idx_country_active` (`country_code`, `is_active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

SET FOREIGN_KEY_CHECKS = 1; 