declare namespace fs {
  function readFileSync(
    path: string,
    options?: { encoding?: null } | "utf-8"
  ): string;

  function writeFileSync(
    path: string,
    data: string,
    options?: { encoding?: null } | "utf-8"
  );

  function existsSync(path: string): boolean;

  function mkdirSync(path: string, options?: { recursive?: boolean });

  function readDirSync(path: string): string[];

  function statSync(path: string): {
    isFile: boolean;
    isDirectory: boolean;
    size: number;
  };
}

declare namespace req {
  const method: string;
  const path: string;
  const originalUrl: string;
  const functionPath: string;
  const headers: Record<string, string | string[]>;
  const query: Record<string, string | string[]>;
  const params: Record<string, string | string[]>;
  const body: unknown;
}

declare namespace res {
  let statusCode: number;
  let headers: Record<string, string | string[]>;
  let body: unknown;

  function setStatus(code: number): typeof res;
  function setHeader(name: string, value: string | string[]): typeof res;
  function setHeaders(map: Record<string, string | string[]>): typeof res;
  function removeHeader(name: string): typeof res;
  function reset(): typeof res;
  function send(payload: unknown): typeof res;
  function json(payload: unknown): typeof res;
}

declare namespace sql {
  function query<T = unknown>(query: string, params?: unknown[]): Promise<T[]>;

  function execute(
    query: string,
    params?: unknown[]
  ): Promise<{ rowsAffected: number }>;
}
