package com.oguerreiro.resilient.service.dto;

import java.util.HashSet;
import java.util.Set;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

/**
 * A DTO for the {@link com.oguerreiro.resilient.domain.VariableClassType} entity.
 */
@Schema(description = "VariableClassType")
public class VariableClassTypeDTO extends AbstractResilientDTO<Long> {
  private static final long serialVersionUID = 1L;

  @NotNull
  @Schema(description = "The internal name for the class type.", requiredMode = Schema.RequiredMode.REQUIRED)
  private String name;

  @NotNull
  @Size(min = 1)
  @Schema(description = "User defined code. Must be unique.", requiredMode = Schema.RequiredMode.REQUIRED)
  private String code;

  @NotNull
  private String description;

  @NotNull
  @Schema(description = "Label for the class to be used in user interface. Might be overriden by Variable configuration.", requiredMode = Schema.RequiredMode.REQUIRED)
  private String label;

  private Set<VariableClassDTO> variableClasses = new HashSet<>();

  @Schema(description = "Record version for concurrency control.")
  private Integer version;

  public String getCode() {
    return code;
  }

  public void setCode(String code) {
    this.code = code;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public String getLabel() {
    return label;
  }

  public void setLabel(String label) {
    this.label = label;
  }

  public Set<VariableClassDTO> getVariableClasses() {
    return variableClasses;
  }

  public void setVariableClasses(Set<VariableClassDTO> variableClasses) {
    this.variableClasses = variableClasses;
  }

  public Integer getVersion() {
    return version;
  }

  public void setVersion(Integer version) {
    this.version = version;
  }

//@formatter:off
  @Override
  public String toString() {
    return "VariableClassTypeDTO{" + 
              "id=" + getId() + 
              ", code='" + getCode() + "'" + 
              ", name='" + getName() + "'" + 
              ", description='" + getDescription() + "'" + 
              ", label='" + getLabel() + "'" + 
              ", version=" + getVersion()
        + "}";
  }
//@formatter:on
}
