export interface HealthResponse {
  status: "ok";
}

export interface ErrorResponse {
  error: string;
  details?: Record<string, unknown>;
}

export interface OrganizationSummaryListItem {
  id: string;
  slug: string;
  name: string;
  plan: string;
  industry: string;
  createdAt: string;
  projectCount: number;
  taskCount: number;
  openTaskCount: number;
}

export interface StatusBreakdownItem {
  status: string;
  count: number;
}

export interface OrganizationDetail extends OrganizationSummaryListItem {
  userCount: number;
  statusBreakdown: StatusBreakdownItem[];
}

export interface User {
  id: string;
  orgId: string;
  fullName: string;
  email: string;
  role: string;
  timezone: string;
}

export interface Project {
  id: string;
  orgId: string;
  key: string;
  name: string;
  status: string;
  ownerUserId: string;
  ownerName: string | null;
  dueDate: string | null;
  taskCount: number;
}

export interface TaskListItem {
  id: string;
  orgId: string;
  projectId: string;
  assigneeUserId: string | null;
  title: string;
  description: string;
  status: string;
  priority: string;
  storyPoints: number | null;
  dueDate: string | null;
  createdAt: string;
  updatedAt: string;
  projectName: string;
  projectKey: string;
  assigneeName: string | null;
}

export interface Label {
  id: string;
  name: string;
  color: string;
}

export interface Comment {
  id: string;
  authorUserId: string;
  authorName: string;
  body: string;
  createdAt: string;
}

export interface TaskDetail extends TaskListItem {
  labels: Label[];
  comments: Comment[];
}

export interface OrganizationsEnvelope {
  organizations: OrganizationSummaryListItem[];
}

export interface OrganizationEnvelope {
  organization: OrganizationDetail;
}

export interface UsersEnvelope {
  users: User[];
}

export interface ProjectsEnvelope {
  projects: Project[];
}

export interface TasksEnvelope {
  tasks: TaskListItem[];
}

export interface TaskEnvelope {
  task: TaskDetail;
}

export interface CreateTaskRequest {
  orgId: string;
  projectId: string;
  assigneeUserId?: string | null;
  title: string;
  description?: string;
  status?: string;
  priority?: string;
  storyPoints?: number | null;
  dueDate?: string | null;
}

export interface UpdateTaskRequest {
  title?: string;
  description?: string;
  status?: string;
  priority?: string;
  assigneeUserId?: string | null;
  storyPoints?: number | null;
  dueDate?: string | null;
}
