import { type CloudProvider } from 'dbaas/features/Project'
import { AwsPrivateEndpointCreation } from 'dbaas/screens/ConsoleV2/features/Network/PrivateEndpoint/aws'
import { AzurePrivateEndpointCreation } from 'dbaas/screens/ConsoleV2/features/Network/PrivateEndpoint/azure'
import { GcpPrivateEndpointCreation } from 'dbaas/screens/ConsoleV2/features/Network/PrivateEndpoint/gcp'

interface PrivateEndpointInitProps {
  mode?: 'cluster' | 'node-group'
  clusterId: string
  nodeGroupId?: string
  provider: CloudProvider
  onCancel: () => void
  onBack: () => void
  onConfirm: () => void
}

export const PrivateEndpointInit = ({
  clusterId,
  provider,
  mode,
  nodeGroupId,
  ...restProps
}: PrivateEndpointInitProps) => {
  if (provider === 'aws') {
    return <AwsPrivateEndpointCreation clusterId={clusterId} nodeGroupId={nodeGroupId} {...restProps} />
  }

  if (provider === 'gcp') {
    return <GcpPrivateEndpointCreation clusterId={clusterId} nodeGroupId={nodeGroupId} {...restProps} />
  }

  if (provider === 'azure') {
    return <AzurePrivateEndpointCreation clusterId={clusterId} nodeGroupId={nodeGroupId} {...restProps} />
  }

  return null
}
