// Mirrors Go struct definitions in internal/models/
// Keep in sync with backend JSON serialization.

export interface User {
  id: number
  username: string
  email: string
  avatarUrl: string
  isAdmin: boolean
  createdAt: string // ISO 8601
  updatedAt: string
}

export interface Repository {
  id: number
  ownerId: number
  ownerName: string
  name: string
  description: string
  isPrivate: boolean
  defaultBranch: string
  isEmpty: boolean
  size: number
  avatarUrl: string
  createdAt: string
  updatedAt: string
}

export type PRStatus = 'open' | 'merged' | 'closed'

export interface PullRequest {
  id: number
  repoId: number
  authorId: number
  title: string
  body: string
  sourceBranch: string
  targetBranch: string
  status: PRStatus
  createdAt: string
  updatedAt: string
}

export interface TreeEntry {
  mode: string
  type: 'blob' | 'tree'
  hash: string
  name: string
  size: number
  commitHash: string
  commitMsg: string
  commitDate: string
}

export interface Commit {
  hash: string
  author: string
  message: string
  date: string
}

export interface Pipeline {
  id: number
  repoId: number
  ref: string
  status: 'pending' | 'running' | 'success' | 'failure' | 'cancelled'
  createdAt: string
  updatedAt: string
}

export type IssueState = 'open' | 'closed'

export interface Issue {
  id: number
  repoId: number
  authorId: number
  authorName: string
  number: number
  title: string
  body: string
  state: IssueState
  createdAt: string
  updatedAt: string
}

export interface SSHKey {
  id: number
  userId: number
  title: string
  fingerprint: string
  publicKey: string
  createdAt: string
}

export interface ApiError {
  error: string
  status: number
}

export interface HealthResponse {
  status: 'ok'
}
