import { useNavigate } from 'react-router-dom'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Button } from '@/components/ui/button'
import { Trash2 } from 'lucide-react'

interface TaskNotFoundProps {
  taskId: string | null
  onClearAndUpload: () => void
}

export default function TaskNotFound({ taskId, onClearAndUpload }: TaskNotFoundProps) {
  const navigate = useNavigate()

  const handleClick = () => {
    onClearAndUpload()
    navigate('/upload')
  }

  return (
    <div className="flex items-center justify-center min-h-[60vh]">
      <Card className="max-w-md text-center">
        <CardHeader>
          <div className="flex justify-center mb-4">
            <div className="w-16 h-16 bg-destructive/10 rounded-full flex items-center justify-center">
              <Trash2 className="w-8 h-8 text-destructive" />
            </div>
          </div>
          <CardTitle className="text-xl">任務已刪除</CardTitle>
        </CardHeader>
        <CardContent className="space-y-4">
          <p className="text-muted-foreground">
            此任務已被刪除或不存在。請上傳新檔案以建立新任務。
          </p>
          {taskId && (
            <p className="text-xs text-muted-foreground font-mono">
              任務 ID: {taskId}
            </p>
          )}
          <Button onClick={handleClick} size="lg">
            前往上傳頁面
          </Button>
        </CardContent>
      </Card>
    </div>
  )
}
