import type { JSX } from "react";
import { Skeleton } from "@/shared/components/ui/skeleton";

/** 版本列表骨架屏 */
export function VersionListSkeleton(): JSX.Element {
  return (
    <div className="flex flex-col gap-2">
      {Array.from({ length: 5 }).map((_, i) => (
        <div
          key={i}
          className="border border-outline-variant rounded-lg p-3 space-y-2"
        >
          <div className="flex justify-between items-center">
            <Skeleton className="h-4 w-12" />
            <Skeleton className="h-3 w-8" />
          </div>
          <Skeleton className="h-3 w-32" />
          <Skeleton className="h-3 w-24" />
          <Skeleton className="h-6 w-28" />
        </div>
      ))}
    </div>
  );
}

/** 题库列表骨架屏 */
export function QuestionBankSkeleton(): JSX.Element {
  return (
    <div className="space-y-2">
      {Array.from({ length: 6 }).map((_, i) => (
        <div
          key={i}
          className="border rounded p-2 flex justify-between items-center"
        >
          <Skeleton className="h-4 flex-1 mr-2" />
          <Skeleton className="h-3 w-16 mr-2" />
          <Skeleton className="h-6 w-12" />
        </div>
      ))}
    </div>
  );
}

/** 知识点列表骨架屏 */
export function KnowledgePointSkeleton(): JSX.Element {
  return (
    <div className="space-y-1">
      {Array.from({ length: 8 }).map((_, i) => (
        <div key={i} className="flex items-center gap-2 p-2">
          <Skeleton className="h-4 w-4" />
          <Skeleton className="h-4 flex-1" />
        </div>
      ))}
    </div>
  );
}

/** 课案列表骨架屏 */
export function LessonPlanListSkeleton(): JSX.Element {
  return (
    <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
      {Array.from({ length: 6 }).map((_, i) => (
        <div
          key={i}
          className="border border-outline-variant rounded-lg p-4 space-y-3"
        >
          <Skeleton className="h-5 w-3/4" />
          <Skeleton className="h-3 w-1/2" />
          <Skeleton className="h-3 w-2/3" />
          <Skeleton className="h-3 w-1/3" />
          <div className="flex gap-2 mt-3">
            <Skeleton className="h-7 w-16" />
            <Skeleton className="h-7 w-16" />
          </div>
        </div>
      ))}
    </div>
  );
}
