<?php
class TipoDocumentoAdjunto{
    public $id;
    public $tipoDocumento;

    public function __construct()
    {
        
    }

    public static function obtenerTodos($db = null):object{
        try {
            if(empty($db)) $db = obtenerConexion();

            $query = "SELECT * FROM general.view_tiposDocumentosAdjuntos where estado = 1;";
            $stmt = $db->prepare($query, [PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL]);
            $stmt->execute();

            $data = $stmt->fetchAll(PDO::FETCH_CLASS, __CLASS__);

            return (object)['status' => 200, 'data' => $data];
        } catch (PDOException $e) {
            return (object)[
                'status' => 500,
                'message' => $e->getMessage()
            ];
        } catch (Exception $e) {
            return (object)[
                'status' => 500,
                'message' => $e->getMessage()
            ];
        }
    }
}