import { createKysely } from "@vercel/postgres-kysely";
import { Generated, KyselyConfig } from "kysely";

// fuck it new kysely
export interface Database {
  apps: AppTable;
  users: UserTable;
  jams: JamTable;
  content: ContentTable;
  judgements: JudgementTable;
  tokens: TokenTable;
}

export interface AppTable {
  instance_domain: string;
  client_id: string;
  client_secret: string;
  redirect_uri: string;
}

export interface UserTable {
  id: string;
  instance: string;
  username: string;
  admin: boolean;
  url: string;
  banned: boolean;
  joined: number;
}

export interface TokenTable {
  id: string;
  owner: string;
  created: number;
  expires: number;
}

export interface JamTable {
  id: string;
  author_id: string;
  name: string;
  description: string;
  date_start: number;
  date_end: number;
  created: number;
  theme: string;
  theme_description: string;
}

export interface ContentTable {
  id: string;
  author_id: string;
  jam_id: string;
  name: string;
  description: string;
  url: string;
  submitted: number;
  winner: boolean;
}

export interface JudgementTable {
  id: string;
  author_id: string;
  content_id: string;
  content: string;
  published: number;
}

export const db = createKysely<Database>({
  
});