import * as React from 'react'
import { Bidding } from '@/db/schema'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Badge } from '@/components/ui/badge'
// import { formatDate } from '@/lib/utils'
import { biddingStatusLabels, contractTypeLabels } from '@/db/schema'

interface BiddingInfoCardProps {
  bidding: Bidding
}

export function BiddingInfoCard({ bidding }: BiddingInfoCardProps) {
  return (
    <Card>
      <CardHeader>
        <CardTitle>입찰정보</CardTitle>
      </CardHeader>
      <CardContent>
        <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
          {/* 입찰명 */}
          <div className="space-y-2">
            <label className="text-sm font-medium text-muted-foreground">
              입찰명
            </label>
            <div className="text-sm font-medium">
              {bidding.title || '-'}
            </div>
          </div>

          {/* 입찰번호 */}
          <div className="space-y-2">
            <label className="text-sm font-medium text-muted-foreground">
              입찰번호
            </label>
            <div className="text-sm font-medium">
              {bidding.biddingNumber || '-'}
            </div>
          </div>

          {/* 내정가 */}
          <div className="space-y-2">
            <label className="text-sm font-medium text-muted-foreground">
              내정가
            </label>
            <div className="text-sm font-medium">
              {bidding.targetPrice
                ? `${Number(bidding.targetPrice).toLocaleString()} ${bidding.currency || 'KRW'}`
                : '-'
              }
            </div>
          </div>

          {/* 입찰유형 */}
          <div className="space-y-2">
            <label className="text-sm font-medium text-muted-foreground">
              입찰유형
            </label>
            <div className="text-sm font-medium">
              {bidding.isPublic ? '공개입찰' : '비공개입찰'}
            </div>
          </div>

          {/* 진행상태 */}
          <div className="space-y-2">
            <label className="text-sm font-medium text-muted-foreground">
              진행상태
            </label>
            <Badge variant="secondary">
              {biddingStatusLabels[bidding.status as keyof typeof biddingStatusLabels] || bidding.status}
            </Badge>
          </div>

          {/* 입찰담당자 */}
          <div className="space-y-2">
            <label className="text-sm font-medium text-muted-foreground">
              입찰담당자
            </label>
            <div className="text-sm font-medium">
              {bidding.bidPicName || '-'}
            </div>
          </div>

          {/* 계약구분 */}
          <div className="space-y-2">
            <label className="text-sm font-medium text-muted-foreground">
              계약구분
            </label>
            <div className="text-sm font-medium">
              {contractTypeLabels[bidding.contractType as keyof typeof contractTypeLabels] || bidding.contractType}
            </div>
          </div>
        </div>
      </CardContent>
    </Card>
  )
}
