CREATE TABLE IF NOT EXISTS site_settings (
    id INT PRIMARY KEY DEFAULT 1,
    brand_name VARCHAR(120) NOT NULL DEFAULT '360training',
    brand_subtitle VARCHAR(120) NOT NULL DEFAULT '',
    logo_path VARCHAR(255) NOT NULL DEFAULT 'uploads/logo.png',
    header_logo_url VARCHAR(255) NOT NULL DEFAULT 'https://360training.lat',
    footer_title VARCHAR(255) NOT NULL DEFAULT '360training is a company that includes the following family of brands:',
    footer_address VARCHAR(255) NOT NULL DEFAULT '',
    footer_email VARCHAR(120) NOT NULL DEFAULT '',
    footer_phones VARCHAR(120) NOT NULL DEFAULT '',
    footer_domain VARCHAR(120) NOT NULL DEFAULT '360training.lat',
    menu_links TEXT NOT NULL,
    gradient_start VARCHAR(20) NOT NULL DEFAULT '#0072e5',
    gradient_mid VARCHAR(20) NOT NULL DEFAULT '#00b84c',
    gradient_end VARCHAR(20) NOT NULL DEFAULT '#ff8c00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO site_settings (
    id, brand_name, brand_subtitle, logo_path, header_logo_url, footer_title,
    footer_address, footer_email, footer_phones, footer_domain,
    menu_links, gradient_start, gradient_mid, gradient_end
) VALUES (
    1,
    '360training',
    '',
    'uploads/logo.png',
    'https://360training.lat',
    '360training is a company that includes the following family of brands:',
    '',
    '',
    '',
    '360training.lat',
    'OSHAcampus®|https://360training.lat
Learn2Serve®|https://360training.lat
Agent Campus®|https://360training.lat
VanEd®|https://360training.lat
TIPS®|https://360training.lat
HIPAA Exams®|https://360training.lat
OSHA.com|https://360training.lat
ACLS Medical Training|https://360training.lat
Hard Hat Training|https://360training.lat
American Resuscitation Council|https://360training.lat
AdvanceOnline|https://360training.lat
Compliance Training Online|https://360training.lat
Mortgage Educators and Compliance|https://360training.lat',
    '#0072e5',
    '#00b84c',
    '#ff8c00'
) ON DUPLICATE KEY UPDATE
    brand_name = VALUES(brand_name),
    logo_path = VALUES(logo_path),
    header_logo_url = VALUES(header_logo_url),
    footer_title = VALUES(footer_title),
    footer_domain = VALUES(footer_domain),
    menu_links = VALUES(menu_links);

CREATE TABLE IF NOT EXISTS certificates (
    id INT AUTO_INCREMENT PRIMARY KEY,
    cert_code VARCHAR(32) NOT NULL UNIQUE,
    student_name VARCHAR(180) NOT NULL,
    course_name VARCHAR(255) NOT NULL,
    issue_date VARCHAR(40) NOT NULL,
    status ENUM('valid', 'invalid') NOT NULL DEFAULT 'valid',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
