import { sqliteTable, text, int } from 'drizzle-orm/sqlite-core'

export const cards = sqliteTable('cards', {
  id: int('id').primaryKey({ autoIncrement: true }),
  esid: text('esid').notNull(),
  url_audio: text('url_audio').notNull(),
  url_image: text('url_image').notNull(),
  year: text('year').notNull(),
  month: text('month').notNull(),
  day: text('day').notNull(),
  hour: text('hour').notNull(),
  artist: text('artist').notNull(),
  title: text('title').notNull(),
  slug: text('slug').notNull(),
  suit: text('suit').notNull(),
  rank: text('rank').notNull(),
  blurhash: text('blurhash').notNull(), // blurhash of the image
  createdAt: int('created_at', { mode: 'timestamp' })
    .notNull()
    .$defaultFn(() => new Date()),
  updatedAt: int('updated_at', { mode: 'timestamp' })
    .notNull()
    .$defaultFn(() => new Date())
})
