<?php
    $request_method = $_SERVER["REQUEST_METHOD"];

    include "MySql.php";
    include "retorno.php";

    $conn = new MySql();

    $sql = "select * from tb_estados where 1";
    $result = $conn->query($sql);

    if($result->num_rows == 0){
        $json = array('status'=>0, 'message'=>"Erro ao acessar dados");

        returnJSON($json, 500);
        exit;
    }

    $json = array();
    
    while( $dados = $result->fetch_assoc() ){
        array_push($json, 
            array('id'=>$dados['id'], 'estado'=>$dados['uf'])
        );
    }

    returnJSON($json, 200);

    exit;
?>