'use client';

import { OrganizationAllowedEmailsManager } from '@/components/OrganizationAllowedEmailsManager';
import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
} from '@/components/ui/dialog';

interface AllowedEmailsDialogProps {
  isOpen: boolean;
  onClose: () => void;
  organizationId: string;
  organizationName: string;
  onEmailListChanged?: () => void;
}

export function AllowedEmailsDialog({
  isOpen,
  onClose,
  organizationId,
  organizationName,
  onEmailListChanged,
}: AllowedEmailsDialogProps) {
  return (
    <Dialog open={isOpen} onOpenChange={onClose}>
      <DialogContent className="max-w-4xl max-h-[80vh] overflow-y-auto">
        <DialogHeader>
          <DialogTitle>Gerenciar Emails Permitidos</DialogTitle>
          <DialogDescription>
            Configure quais emails externos podem se registrar na organização{' '}
            <strong>{organizationName}</strong>
          </DialogDescription>
        </DialogHeader>

        <OrganizationAllowedEmailsManager
          organizationId={organizationId}
          organizationName={organizationName}
          onEmailListChanged={onEmailListChanged}
        />
      </DialogContent>
    </Dialog>
  );
}
