import { PgColumn, PgTableWithColumns } from "drizzle-orm/pg-core";

export type GetColumns<T> =
  T extends PgTableWithColumns<infer Table> ? Table["columns"] : never;

export type ExtractDataTypes<T> = {
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  [K in keyof T]: T[K] extends PgColumn<infer ColumnConfig, any, any>
    ? ColumnConfig["notNull"] extends true
      ? ColumnConfig["data"]
      : ColumnConfig["data"] | null
    : unknown;
};
