export const REPORT_PAGE_SIZE = 10

export type ReportTone = 'success' | 'info' | 'warning' | 'destructive' | 'primary' | 'muted'

export const REPORT_TONE_BADGE: Record<ReportTone, string> = {
  success: 'bg-success/10 text-success',
  info: 'bg-info/10 text-info',
  warning: 'bg-warning/15 text-warning',
  destructive: 'bg-destructive/10 text-destructive',
  primary: 'bg-primary/10 text-primary',
  muted: 'bg-muted text-muted-foreground'
}

export const REPORT_TONE_BAR: Record<ReportTone, string> = {
  success: 'bg-success',
  info: 'bg-info',
  warning: 'bg-warning',
  destructive: 'bg-destructive',
  primary: 'bg-primary',
  muted: 'bg-muted-foreground/40'
}

export const REPORT_TONE_TEXT: Record<ReportTone, string> = {
  success: 'text-success',
  info: 'text-info',
  warning: 'text-warning',
  destructive: 'text-destructive',
  primary: 'text-primary',
  muted: 'text-muted-foreground'
}

export function reportPageWindow(page: number, count: number): Array<number | '...'> {
  if (count <= 7) return Array.from({ length: count }, (_, index) => index + 1)

  const output: Array<number | '...'> = [1]
  const low = Math.max(2, page - 1)
  const high = Math.min(count - 1, page + 1)

  if (low > 2) output.push('...')
  for (let index = low; index <= high; index += 1) output.push(index)
  if (high < count - 1) output.push('...')
  output.push(count)

  return output
}
