# generated by datamodel-codegen:
#   filename:  schema/api/services/ingestionPipelines/testServiceConnection.json
#   timestamp: 2022-06-14T09:18:33+00:00

from __future__ import annotations

from enum import Enum
from typing import Optional, Union

from pydantic import BaseModel, Extra, Field

from ....entity.services import dashboardService, databaseService, messagingService


class ConnectionType1(Enum):
    Database = 'Database'
    Dashboard = 'Dashboard'
    Messaging = 'Messaging'
    Pipeline = 'Pipeline'


class TestServiceConnectionRequest(BaseModel):
    class Config:
        extra = Extra.forbid

    connection: Optional[
        Union[
            databaseService.DatabaseConnection,
            dashboardService.DashboardConnection,
            messagingService.MessagingConnection,
        ]
    ] = Field(None, description='Connection object.')
    connectionType: Optional[ConnectionType1] = Field(
        None,
        description='Type of database service such as MySQL, BigQuery, Snowflake, Redshift, Postgres...',
    )
