CREATE TABLE IF NOT EXISTS company_settings (
    id TINYINT UNSIGNED NOT NULL DEFAULT 1 PRIMARY KEY,
    company_name VARCHAR(200) NULL,
    person_name VARCHAR(200) NULL,
    street VARCHAR(200) NULL,
    city VARCHAR(128) NULL,
    postal_code VARCHAR(16) NULL,
    country_code CHAR(2) NOT NULL DEFAULT 'PL',
    phone VARCHAR(64) NULL,
    email VARCHAR(128) NULL,
    tax_number VARCHAR(64) NULL,
    bank_account VARCHAR(64) NULL,
    bank_owner_name VARCHAR(200) NULL,
    default_package_length_cm DECIMAL(8,1) NOT NULL DEFAULT 25.0,
    default_package_width_cm DECIMAL(8,1) NOT NULL DEFAULT 20.0,
    default_package_height_cm DECIMAL(8,1) NOT NULL DEFAULT 8.0,
    default_package_weight_kg DECIMAL(8,3) NOT NULL DEFAULT 1.000,
    default_label_format VARCHAR(8) NOT NULL DEFAULT 'PDF',
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO company_settings (id) VALUES (1)
ON DUPLICATE KEY UPDATE updated_at = VALUES(updated_at);
