package api

// ConnectionModel is the model for connection information
// it combines the test connection and validate changefeed parameters functions
type ConnectionModel struct {
	Type        string          `json:"type"`
	User        string          `json:"user"`
	Password    string          `json:"password"`
	Url         string          `json:"url"`
	Topic       string          `json:"topic"`
	Database    string          `json:"database"`
	AuthType    string          `json:"auth_type"`
	EnableTls   bool            `json:"enable_tls"`
	KafkaItem   KafkaItem       `json:"kafka_item"`
	S3Param     S3Parameter     `json:"s3_param"`
	GCSParam    GcsParameter    `json:"gcs_param"`
	PulsarParam PulsarParameter `json:"pulsar_param"`
}

// KafkaItem is the model for kafka changefeed parameter verification
type KafkaItem struct {
	ReplicationFactor       uint32 `json:"replication_factor"`
	PartitionNum            uint32 `json:"partition_num"`
	SchemaRegistryEndpoints string `json:"schema_registry_endpoints"`
}

// S3Parameter is the model for s3 changefeed parameter verification
type S3Parameter struct {
	S3Uri           string `json:"s3_uri"`
	AccessKeyId     string `json:"access_key_id"`
	SecretAccessKey string `json:"secret_access_key"`
	RoleArn         string `json:"role_arn"`
	ExternalID      string `json:"external_id"`
}

// GcsParameter is the model for gcs changefeed parameter verification
type GcsParameter struct {
	GcsUrl                    string `json:"gcs_url"`
	Region                    string `json:"region"`
	ImpersonateServiceAccount string `json:"impersonate_service_account"`
}

// PulsarParameter is the model for pulsar changefeed parameter verification
type PulsarParameter struct {
	ServiceURL         string `json:"service_url"`
	AuthenticationType string `json:"authentication_type"`
	Username           string `json:"username"`
	Password           string `json:"password"`
	Token              string `json:"token"`
	ConnectionTimeout  uint32 `json:"connection_timeout"`
	Tenant             string `json:"tenant"`
	Namespace          string `json:"namespace"`
	Topic              string `json:"topic"`
}
