import { Box, Button, Typography } from '@mui/material'
import { FileText } from 'lucide-react'
import { useOfferWizardStore } from '../../stores/offerWizardStore'

interface OfferCreationPanelProps {
  selectedCount: number
  needId: string
  needTitle: string
}

export function OfferCreationPanel({ selectedCount, needId, needTitle }: OfferCreationPanelProps) {
  const open = useOfferWizardStore(s => s.open)
  if (selectedCount === 0) return null

  return (
    <Box
      sx={{
        borderTop: '1px solid #e2e8f0',
        bgcolor: '#f8fafc',
        p: 1.5,
        display: 'flex',
        flexDirection: 'column',
        gap: 1,
        flexShrink: 0,
      }}
    >
      <Typography variant="body2" sx={{ fontWeight: 600, fontSize: '0.85rem', color: '#0f172a' }}>
        {selectedCount} Objekt{selectedCount === 1 ? '' : 'e'} ausgewählt
      </Typography>
      <Button
        fullWidth
        variant="contained"
        size="small"
        startIcon={<FileText size={14} />}
        onClick={() => open(needId, needTitle)}
        sx={{
          textTransform: 'none',
          bgcolor: '#152642',
          fontWeight: 600,
          '&:hover': { bgcolor: '#16304d' },
        }}
      >
        Angebot erstellen
      </Button>
    </Box>
  )
}
