<?php
require_once __DIR__ . '/db_connection.php';
header('Content-Type: application/json');

$response = [ 'success' => false, 'data' => null ];

try {
    $sql = "SELECT branding_color_primary, branding_color_secondary, branding_color_accent FROM business_info WHERE id = 1";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    $colors = $stmt->fetch(PDO::FETCH_ASSOC);

    if ($colors) {
        $response['success'] = true;
        $response['data'] = $colors;
    }
} catch (Exception $e) {
    error_log('Error en colors-read.php: ' . $e->getMessage());
}

echo json_encode($response);
?>