package de.tsschulz.tt_tagebuch.shared.api.models

import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonObject

@Serializable
data class MemberTransferLoginCredentialsDto(
    val username: String? = null,
)

@Serializable
data class MemberTransferConfigDto(
    val id: Int? = null,
    val clubId: Int? = null,
    val server: String? = null,
    val loginEndpoint: String? = null,
    val loginFormat: String? = null,
    val loginCredentials: MemberTransferLoginCredentialsDto? = null,
    val transferEndpoint: String? = null,
    val transferMethod: String? = null,
    val transferFormat: String? = null,
    val transferTemplate: String? = null,
    val useBulkMode: Boolean? = null,
    val bulkWrapperTemplate: String? = null,
)

@Serializable
data class MemberTransferConfigEnvelope(
    val success: Boolean = false,
    val config: MemberTransferConfigDto? = null,
    val message: String? = null,
    val error: String? = null,
)

@Serializable
data class MemberTransferConfigSaveBody(
    val server: String,
    val loginEndpoint: String? = null,
    val loginFormat: String = "json",
    val loginCredentials: JsonObject? = null,
    val transferEndpoint: String,
    val transferMethod: String = "POST",
    val transferFormat: String = "json",
    val transferTemplate: String,
    val useBulkMode: Boolean = false,
    val bulkWrapperTemplate: String? = null,
)

@Serializable
data class MemberTransferRunBody(
    val transferEndpoint: String,
    val transferMethod: String = "POST",
    val transferFormat: String = "json",
    val transferTemplate: String,
    val useBulkMode: Boolean = false,
    val bulkWrapperTemplate: String? = null,
    val loginEndpoint: String? = null,
    val loginFormat: String? = null,
    val loginCredentials: JsonObject? = null,
)
