<?php
class PlanoManager {
    private $conn;

    public function __construct($conn) {
        $this->conn = $conn;
    }

    public function listarPlanos() {
        $result = $this->conn->query("SELECT * FROM planos");
        $planos = [];
        while ($row = $result->fetch_assoc()) {
            $planos[] = $row;
        }
        return $planos;
    }

    public function getPlano($plano_id) {
        $stmt = $this->conn->prepare("SELECT * FROM planos WHERE id = ?");
        $stmt->bind_param("i", $plano_id);
        $stmt->execute();
        $result = $stmt->get_result();
        $plano = $result->fetch_assoc();
        $stmt->close();
        return $plano;
    }
}