type ResourceShort = {
  id: number
  resource_id: number
  type: number
  live: number
  expire_at: Date
  quota: number
  used: number
  daily: number
  last_at?: Date
}

type ResourceLong = {
  id: number
  resource_id: number
  type: number
  live: number
  expire_at: Date
  quota: number
  used: number
  daily: number
  last_at?: Date
}

export type Resource<T extends 1 | 2 = 1 | 2> = {
  id: number
  user_id: number
  resource_no: string
  active: boolean
  created_at: Date
  updated_at: Date
} & (
  T extends 1 ? {
    type: 1
    short: ResourceShort
  } :
    T extends 2 ? {
      type: 2
      long: ResourceLong
    } : {}
  )
