package dp.kotul.templategroupsbackend.model.solrsearch.template

import dp.kotul.templategroupsbackend.model.response.TemplateVariableType
import com.fasterxml.jackson.annotation.JsonAlias
import com.fasterxml.jackson.annotation.JsonProperty

data class TemplateSolrVariable (
        @JsonAlias("templateVariableExtId", "id")
        val templateVariableExtId: String,
        @JsonAlias("name", "display_name")
        val name: String,
        @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
        @JsonAlias("templateVariableExtType", "type")
        val templateVariableExtType: String,
        @JsonAlias("defaultValue", "default_value")
        val defaultValue: String?,
        @JsonAlias("mandatoryExt", "required")
        val mandatoryExt: Boolean,
        @JsonAlias("maxLength", "max_length")
        val maxLength: Int
) {
        val type: TemplateVariableType? = TemplateVariableType.getTemplateVariableType(templateVariableExtType)
}
