import type { ReactElement } from 'react'

export type Screen = 'login' | 'workbench'
export type Theme = 'light' | 'dark'
export type WorkbenchView = 'workspace' | 'workspace-explore' | 'project'
export type ChannelKey = 'overview' | 'inbox' | 'tasks' | 'ai' | 'notes' | 'cron' | 'new-channel' | `custom:${string}`

export type Project = {
  id: string
  name: string
  identifier: string
  icon: string
  background: string
  description: string
  short: string
  badge: number
  urgent?: boolean
  color: string
}

export type ProjectChannel = {
  key: ChannelKey
  id: string
  label: string
  count?: number
  icon: ReactElement
  url?: string
  sortOrder: number
}

export type InboxItem = {
  id: string
  title: string
  meta: string
  owner: string
  time: string
  tag: string
  summary: string
  status: string
}

export type InboxConfirmationOutcome = {
  createdCount: number
  refreshError?: string
}

export type TaskItem = {
  id: string
  title: string
  owner: string
  progress: string
  due: string
  createdAt: string
  completedAt: string
  duration: string
  tag: string
  summary: string
  completed: boolean
}

export type AISession = {
  id: string
  title: string
  summary: string
  owner: string
  time: string
}

export type NoteSource = {
  id: string
  title: string
  type: string
  updated: string
  owner: string
  source: string
}

export type CronJob = {
  id: string
  name: string
  expr: string
  status: string
  lastRun: string
  nextRun: string
  owner: string
  enabled: boolean
}

export type ProjectWorkspace = {
  project: Project
  channels: ProjectChannel[]
  tags: string[]
  recentSessions: AISession[]
  inbox: InboxItem[]
  tasks: TaskItem[]
  aiSessions: AISession[]
  notes: NoteSource[]
  cronJobs: CronJob[]
}
