<?php
class VHCOptions {
    public static function getVHCOptionsAndServiceOptionsByVhc($idVHC) {
        // TODO improve request by doing join ?
        $query = "SELECT vo.*, so.Nom_court FROM vhc_option AS vo, service_option AS so WHERE vo.Id_vhc = :idvhc AND vo.Id_option = so.Id";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":idvhc", $idVHC);
        $statement->execute();
        return $statement->fetchAll();
    }

    public static function getByIdVHCAndIdOption($idVHC , $idOption) {
        $query = "SELECT * FROM vhc_option WHERE Id_vhc = :idvhc AND Id_option = :idoption";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":idvhc", $idVHC);
        $statement->bindParam(":idoption", $idOption);
        $statement->execute();
        return $statement->fetch();
    }

    public static function getByIdVHC($idVHC) {
        $query = "SELECT * FROM vhc_option WHERE Id_vhc = :idvhc";
        $statement = Connection::getStatement($query);
        $statement->bindParam(":idvhc", $idVHC);
        $statement->execute();
        return $statement->fetchAll();
    }

   
}