export const queryKeys = {
  auth: {
    user: ["auth", "user"] as const,
  },
  users: {
    all: ["users"] as const,
    list: (params: Record<string, unknown>) => ["users", "list", params] as const,
    detail: (id: number) => ["users", id] as const,
  },
  entities: {
    all: ["entities"] as const,
    list: (params?: Record<string, unknown>) => ["entities", "list", params] as const,
    detail: (id: number) => ["entities", id] as const,
    roles: (entityId: number) => ["entities", entityId, "roles"] as const,
    permissions: (entityId: number) => ["entities", entityId, "permissions"] as const,
  },
  exams: {
    all: ["exams"] as const,
    list: (module: string, params?: Record<string, unknown>) => ["exams", module, params] as const,
    detail: (module: string, id: number) => ["exams", module, id] as const,
    rubrics: (params?: Record<string, unknown>) => ["exams", "rubrics", params] as const,
    rubricGroups: (params?: Record<string, unknown>) => ["exams", "rubric-groups", params] as const,
    structures: (params?: Record<string, unknown>) => ["exams", "structures", params] as const,
    avatars: ["exams", "avatars"] as const,
  },
  assignments: {
    all: ["assignments"] as const,
    list: (params?: Record<string, unknown>) => ["assignments", "list", params] as const,
    detail: (id: number) => ["assignments", id] as const,
  },
  classrooms: {
    all: ["classrooms"] as const,
    list: (params?: Record<string, unknown>) => ["classrooms", "list", params] as const,
    detail: (id: number) => ["classrooms", id] as const,
  },
  stats: {
    sessions: (params?: Record<string, unknown>) => ["stats", "sessions", params] as const,
    stats: (params?: Record<string, unknown>) => ["stats", "stats", params] as const,
    statistical: (params?: Record<string, unknown>) => ["stats", "statistical", params] as const,
    performance: (params?: Record<string, unknown>) => ["stats", "performance", params] as const,
  },
  training: {
    all: ["training"] as const,
    tips: (params?: Record<string, unknown>) => ["training", "tips", params] as const,
    walkthroughs: (module?: string) => ["training", "walkthroughs", module] as const,
  },
  subscriptions: {
    packages: ["subscriptions", "packages"] as const,
    payments: (params?: Record<string, unknown>) => ["subscriptions", "payments", params] as const,
    discounts: (params?: Record<string, unknown>) => ["subscriptions", "discounts", params] as const,
  },
  tickets: {
    all: ["tickets"] as const,
    list: (params?: Record<string, unknown>) => ["tickets", "list", params] as const,
    assigned: ["tickets", "assigned"] as const,
  },
  approvals: {
    all: ["approvals"] as const,
    list: (params?: Record<string, unknown>) => ["approvals", "list", params] as const,
  },
  taxonomy: {
    subjects: ["taxonomy", "subjects"] as const,
    subject: (id: number) => ["taxonomy", "subjects", id] as const,
    tree: (subjectId: number) => ["taxonomy", "tree", subjectId] as const,
    domains: (params?: Record<string, unknown>) => ["taxonomy", "domains", params] as const,
    topics: (params?: Record<string, unknown>) => ["taxonomy", "topics", params] as const,
  },
  adaptive: {
    proficiency: (params?: Record<string, unknown>) => ["adaptive", "proficiency", params] as const,
    summary: ["adaptive", "proficiency", "summary"] as const,
    plan: (params?: Record<string, unknown>) => ["adaptive", "plan", params] as const,
    topicContent: (topicId: number) => ["adaptive", "topic", topicId, "content"] as const,
    diagnostic: (sessionId: number) => ["adaptive", "diagnostic", sessionId] as const,
  },
  resources: {
    all: ["resources"] as const,
    list: (params?: Record<string, unknown>) => ["resources", "list", params] as const,
  },
  lms: {
    courses: (params?: Record<string, unknown>) => ["lms", "courses", params] as const,
    course: (id: number) => ["lms", "courses", id] as const,
    myCourses: ["lms", "my-courses"] as const,
    students: (params?: Record<string, unknown>) => ["lms", "students", params] as const,
    teachers: (params?: Record<string, unknown>) => ["lms", "teachers", params] as const,
    batches: (params?: Record<string, unknown>) => ["lms", "batches", params] as const,
    batch: (id: number) => ["lms", "batches", id] as const,
    timetable: (params?: Record<string, unknown>) => ["lms", "timetable", params] as const,
    attendance: (params?: Record<string, unknown>) => ["lms", "attendance", params] as const,
    grades: (params?: Record<string, unknown>) => ["lms", "grades", params] as const,
  },
  analytics: {
    student: (params?: Record<string, unknown>) => ["analytics", "student", params] as const,
    class: (params?: Record<string, unknown>) => ["analytics", "class", params] as const,
    subject: (params?: Record<string, unknown>) => ["analytics", "subject", params] as const,
    contentGaps: (params?: Record<string, unknown>) => ["analytics", "content-gaps", params] as const,
    alerts: ["analytics", "alerts"] as const,
  },
  academicYears: {
    all: ["academic-years"] as const,
    list: (params?: Record<string, unknown>) => ["academic-years", "list", params] as const,
    detail: (id: number) => ["academic-years", id] as const,
  },
  academicTerms: {
    all: ["academic-terms"] as const,
    list: (params?: Record<string, unknown>) => ["academic-terms", "list", params] as const,
    detail: (id: number) => ["academic-terms", id] as const,
  },
  departments: {
    all: ["departments"] as const,
    list: (params?: Record<string, unknown>) => ["departments", "list", params] as const,
    detail: (id: number) => ["departments", id] as const,
  },
  admissionRegisters: {
    all: ["admission-registers"] as const,
    list: (params?: Record<string, unknown>) => ["admission-registers", "list", params] as const,
    detail: (id: number) => ["admission-registers", id] as const,
  },
  admissions: {
    all: ["admissions"] as const,
    list: (params?: Record<string, unknown>) => ["admissions", "list", params] as const,
    detail: (id: number) => ["admissions", id] as const,
  },
  instExamSessions: {
    all: ["inst-exam-sessions"] as const,
    list: (params?: Record<string, unknown>) => ["inst-exam-sessions", "list", params] as const,
    detail: (id: number) => ["inst-exam-sessions", id] as const,
  },
  examTypes: {
    all: ["exam-types"] as const,
    list: (params?: Record<string, unknown>) => ["exam-types", "list", params] as const,
  },
  gradeConfigs: {
    all: ["grade-configs"] as const,
    list: (params?: Record<string, unknown>) => ["grade-configs", "list", params] as const,
  },
  resultTemplates: {
    all: ["result-templates"] as const,
    list: (params?: Record<string, unknown>) => ["result-templates", "list", params] as const,
  },
  marksheets: {
    all: ["marksheets"] as const,
    list: (params?: Record<string, unknown>) => ["marksheets", "list", params] as const,
    detail: (id: number) => ["marksheets", id] as const,
  },
  courseAssignments: {
    all: ["course-assignments"] as const,
    list: (params?: Record<string, unknown>) => ["course-assignments", "list", params] as const,
    detail: (id: number) => ["course-assignments", id] as const,
  },
  assignmentTypes: {
    all: ["assignment-types"] as const,
    list: (params?: Record<string, unknown>) => ["assignment-types", "list", params] as const,
  },
  subjectRegistrations: {
    all: ["subject-registrations"] as const,
    list: (params?: Record<string, unknown>) => ["subject-registrations", "list", params] as const,
    available: (params?: Record<string, unknown>) => ["subject-registrations", "available", params] as const,
  },
  courseCompletion: (courseId: number) => ["course-completion", courseId] as const,
  chapters: (courseId: number) => ["chapters", "list", courseId] as const,
  chapter: (id: number) => ["chapters", "detail", id] as const,
  chapterMaterials: (chapterId: number) => ["chapter-materials", chapterId] as const,
  chapterProgress: (chapterId: number) => ["chapter-progress", chapterId] as const,
  discussionBoards: (params?: Record<string, unknown>) => ["discussion-boards", params] as const,
  posts: (boardId: number, params?: Record<string, unknown>) => ["posts", boardId, params] as const,
  announcements: (params?: Record<string, unknown>) => ["announcements", params] as const,
  messages: (params?: Record<string, unknown>) => ["messages", params] as const,
  sentMessages: (params?: Record<string, unknown>) => ["messages", "sent", params] as const,
  unreadMessages: ["messages", "unread-count"] as const,
  notifications: (params?: Record<string, unknown>) => ["notifications", params] as const,
  unreadNotifications: ["notifications", "unread-count"] as const,
  notificationRules: ["notification-rules"] as const,
  notificationPreferences: ["notification-preferences"] as const,
  faqCategories: (audience?: string) => ["faq", "categories", audience] as const,
  faqItems: (params?: Record<string, unknown>) => ["faq", "items", params] as const,
  studentLeaves: {
    all: ["student-leaves"] as const,
    list: (params?: Record<string, unknown>) => ["student-leaves", "list", params] as const,
  },
  studentLeaveTypes: {
    all: ["student-leave-types"] as const,
    list: (params?: Record<string, unknown>) => ["student-leave-types", "list", params] as const,
  },
  feesPlans: {
    all: ["fees-plans"] as const,
    list: (params?: Record<string, unknown>) => ["fees-plans", "list", params] as const,
    detail: (id: number) => ["fees-plans", id] as const,
  },
  studentFees: {
    all: ["student-fees"] as const,
    list: (params?: Record<string, unknown>) => ["student-fees", "list", params] as const,
  },
  feesTerms: {
    all: ["fees-terms"] as const,
    list: (params?: Record<string, unknown>) => ["fees-terms", "list", params] as const,
  },
  lessons: {
    all: ["lessons"] as const,
    list: (params?: Record<string, unknown>) => ["lessons", "list", params] as const,
  },
  gradebooks: {
    all: ["gradebooks"] as const,
    list: (params?: Record<string, unknown>) => ["gradebooks", "list", params] as const,
  },
  gradebookLines: {
    all: ["gradebook-lines"] as const,
    list: (params?: Record<string, unknown>) => ["gradebook-lines", "list", params] as const,
  },
  gradingAssignments: {
    all: ["grading-assignments"] as const,
    list: (params?: Record<string, unknown>) => ["grading-assignments", "list", params] as const,
  },
  studentProgress: {
    all: ["student-progress"] as const,
    list: (params?: Record<string, unknown>) => ["student-progress", "list", params] as const,
    detail: (id: number) => ["student-progress", "detail", id] as const,
  },
  libraryMedia: {
    all: ["library-media"] as const,
    list: (params?: Record<string, unknown>) => ["library-media", "list", params] as const,
  },
  libraryMovements: {
    all: ["library-movements"] as const,
    list: (params?: Record<string, unknown>) => ["library-movements", "list", params] as const,
  },
  libraryCards: {
    all: ["library-cards"] as const,
    list: (params?: Record<string, unknown>) => ["library-cards", "list", params] as const,
  },
  activities: {
    all: ["activities"] as const,
    list: (params?: Record<string, unknown>) => ["activities", "list", params] as const,
  },
  activityTypes: {
    all: ["activity-types"] as const,
    list: (params?: Record<string, unknown>) => ["activity-types", "list", params] as const,
  },
  facilities: {
    all: ["facilities"] as const,
    list: (params?: Record<string, unknown>) => ["facilities", "list", params] as const,
  },
  assets: {
    all: ["assets"] as const,
    list: (params?: Record<string, unknown>) => ["assets", "list", params] as const,
  },
  signup: {
    goals: ["signup", "goals"] as const,
  },
  placement: {
    results: (sessionId: string) => ["placement", "results", sessionId] as const,
    speakingStatus: (sessionId: string) => ["placement", "speaking-status", sessionId] as const,
    learningPath: (sessionId: string) => ["placement", "learning-path", sessionId] as const,
  },
  examTemplates: {
    international: ["exam-templates", "international"] as const,
    custom: ["exam-templates", "custom"] as const,
    detail: (id: number) => ["exam-templates", id] as const,
  },
  ieltsExam: {
    skills: (examId: number) => ["ielts-exam", examId, "skills"] as const,
    contentPool: (examId: number, filters?: Record<string, unknown>) => ["ielts-exam", examId, "content-pool", filters] as const,
    validation: (examId: number) => ["ielts-exam", examId, "validation"] as const,
  },
  examSession: {
    session: (examId: number) => ["exam-session", examId] as const,
    status: (examId: number) => ["exam-session", examId, "status"] as const,
  },
  grading: {
    queue: (params?: Record<string, unknown>) => ["grading", "queue", params] as const,
    response: (attemptId: number, skill: string) => ["grading", attemptId, "response", skill] as const,
    rubric: (attemptId: number, skill: string) => ["grading", attemptId, "rubric", skill] as const,
  },
  courseGeneration: {
    gapAnalysis: (source: string, sourceId: number) => ["course-gen", "gap", source, sourceId] as const,
    course: (id: number) => ["course-gen", "course", id] as const,
  },
  aiCourse: {
    course: (id: number) => ["ai-course", id] as const,
    tracks: (id: number) => ["ai-course", id, "tracks"] as const,
    quality: (id: number) => ["ai-course", id, "quality"] as const,
    ieltsValidation: (id: number) => ["ai-course", id, "ielts-validation"] as const,
    englishTaxonomy: ["ai-course", "english", "taxonomy"] as const,
  },
  entityOnboarding: {
    credentials: (params?: Record<string, unknown>) => ["entity-onboarding", "credentials", params] as const,
  },
  adaptiveEngine: {
    dashboard: ["adaptive-engine", "dashboard"] as const,
    students: (params?: Record<string, unknown>) => ["adaptive-engine", "students", params] as const,
    signals: (studentId: number) => ["adaptive-engine", "signals", studentId] as const,
    ability: (studentId: number) => ["adaptive-engine", "ability", studentId] as const,
    settings: ["adaptive-engine", "settings"] as const,
  },
  levelMapping: {
    get: (entityId: number) => ["level-mapping", entityId] as const,
  },
  branding: {
    get: (entityId: number) => ["branding", entityId] as const,
    current: ["branding", "current"] as const,
  },
  scoreRelease: {
    pending: (params?: Record<string, unknown>) => ["score-release", "pending", params] as const,
  },
  verification: {
    verify: (hash: string) => ["verification", hash] as const,
  },
};
