// frontend/src/modals/users/DeleteUserModal.jsx
import Modal from '@/components/ui/Modal'
import Button from '@/components/ui/Button'

export default function DeleteUserModal({ user, onConfirm, onCancel, error }) {
  const name  = user?.display_name || 'this user'
  const email = user?.email

  return (
    <Modal
      open={!!user}
      onClose={onCancel}
      title="Delete User"
      size="sm"
      footer={
        <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 'var(--space-3)' }}>
          <Button variant="ghost" onClick={onCancel}>Cancel</Button>
          <Button variant="danger" onClick={onConfirm}>Delete User</Button>
        </div>
      }
    >
      <p style={{ color: 'var(--color-text-secondary)', lineHeight: 'var(--line-height-relaxed)' }}>
        Are you sure you want to delete{' '}
        <strong style={{ color: 'var(--color-text-primary)' }}>{name}</strong>
        {email && <> ({email})</>}?
      </p>
      <p style={{ marginTop: 'var(--space-2)', fontSize: 'var(--font-size-sm)', color: 'var(--color-text-muted)' }}>
        This action cannot be undone.
      </p>
      {error && (
        <p
          style={{
            marginTop: 'var(--space-3)',
            fontSize: 'var(--font-size-sm)',
            color: 'var(--color-danger)',
            backgroundColor: 'var(--color-danger-bg)',
            padding: 'var(--space-2) var(--space-3)',
            borderRadius: 'var(--radius-sm)',
          }}
        >
          {error}
        </p>
      )}
    </Modal>
  )
}
