import type { Status } from '@/stores/statuses.ts'
import type { Project } from '@/stores/projects.ts'
import type { Issue } from '@/stores/issues.ts'

const statuses: Status[] = [
  { id: 1, name: 'todo', description: 'todo', position: 0 },
  { id: 2, name: 'is working', description: '', position: 0 },
  { id: 3, name: 'done', description: '', position: 0 },
]

const projects: Project[] = [{ id: 1, name: 'madsky', description: 'test', key: 'MAD' }]

function getMock(val?: number) {
  const arr = [...Array(val ?? 10).keys()].map((x) => x + 1)
  return arr.map((i) => {
    const issue: Issue = {
      id: i,
      name: `hello ${i}`,
      description: `foo bar baz ${i}`,
      created: new Date().toLocaleDateString(),
      position: 0,
      status_id: 1,
      project_id: 1,
      status: statuses[Math.floor(Math.random() * statuses.length)],
      project: projects[Math.floor(Math.random() * projects.length)],
    }

    return issue
  })
}
