<?php
declare(strict_types=1);

require_once __DIR__ . '/../../config/database.php';
require_once __DIR__ . '/../../core/Response.php';
require_once __DIR__ . '/../../security/auth_guard_api.php';

$db = Database::getInstance();

$stmt = $db->prepare("
    SELECT id, state_name, status
    FROM states
    WHERE status = 'Active'
    ORDER BY state_name ASC
");

$stmt->execute();
$states = $stmt->fetchAll(PDO::FETCH_ASSOC);

Response::success('States loaded', $states);
