CREATE TABLE c6_bank_inss_offers (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    case_id INT UNSIGNED NOT NULL,
    installment_quantity SMALLINT NULL,
    covenant_code VARCHAR(30) NULL,
    product_code VARCHAR(30) NULL,
    requested_amount DECIMAL(12,2) NULL,
    principal_amount DECIMAL(12,2) NULL,
    installment_amount DECIMAL(12,2) NULL,
    gross_amount DECIMAL(12,2) NULL,
    iof_amount DECIMAL(12,2) NULL,
    net_amount DECIMAL(12,2) NULL,
    client_amount DECIMAL(12,2) NULL,
    first_due_date DATE NULL,
    last_due_date DATE NULL,
    monthly_effective_total_cost_rate DECIMAL(12,6) NULL,
    annual_effective_total_cost_rate DECIMAL(12,6) NULL,
    monthly_customer_rate DECIMAL(12,6) NULL,
    annual_customer_rate DECIMAL(12,6) NULL,
    expenses_payload LONGTEXT NULL,
    raw_payload LONGTEXT NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    CONSTRAINT fk_c6_inss_offer_case FOREIGN KEY (case_id) REFERENCES c6_bank_inss_cases (id) ON DELETE CASCADE,
    INDEX idx_c6_inss_offer_case (case_id),
    INDEX idx_c6_inss_offer_installment (installment_quantity)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
