import { Modal } from '@tidbcloud/uikit'

import { TenantRegion } from 'apiClient/services/devops/interface'

import StoredConfig from './StoreConfig'

interface AuditLogEnableModalProps {
  opened: boolean
  tenantId: string
  regionLogicalName: string
  config?: TenantRegion
  onClose: () => void
  onCancel?: () => void
}

const AuditLogEditModal = ({
  opened,
  tenantId,
  regionLogicalName,
  config,
  onClose
}: AuditLogEnableModalProps) => {
  return (
    <Modal
      title={
        config
          ? 'OPS Audit Log Storage Configuration'
          : 'Enable OPS Audit Logging'
      }
      opened={opened}
      onClose={onClose}
      size={800}
      centered
      trapFocus={false}
      closeOnClickOutside={false}
    >
      <StoredConfig
        opened={opened}
        tenantId={tenantId}
        regionLogicalName={regionLogicalName}
        onClose={onClose}
        config={config}
      />
    </Modal>
  )
}

export default AuditLogEditModal
