package com.oguerreiro.resilient.service.dto;

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

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

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

  @NotNull
  @Size(min = 3)
  @Schema(description = "The name of the Organization entry. Allows duplicate name's, but NOT duplicate code's.", requiredMode = Schema.RequiredMode.REQUIRED)
  private String name;

  @Lob
  private byte[] image;

  private String imageContentType;

  private Boolean inputInventory;

  private Boolean outputInventory;

  private UserDTO user;

  private OrganizationDTO parent;

  private OrganizationTypeDTO organizationType;

  private Integer sort;

  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 Integer getSort() {
    return sort;
  }

  public void setSort(Integer sort) {
    this.sort = sort;
  }

  public byte[] getImage() {
    return image;
  }

  public void setImage(byte[] image) {
    this.image = image;
  }

  public String getImageContentType() {
    return imageContentType;
  }

  public void setImageContentType(String imageContentType) {
    this.imageContentType = imageContentType;
  }

  public Boolean getInputInventory() {
    return inputInventory;
  }

  public void setInputInventory(Boolean inputInventory) {
    this.inputInventory = inputInventory;
  }

  public Boolean getOutputInventory() {
    return outputInventory;
  }

  public void setOutputInventory(Boolean outputInventory) {
    this.outputInventory = outputInventory;
  }

  public UserDTO getUser() {
    return user;
  }

  public void setUser(UserDTO user) {
    this.user = user;
  }

  public OrganizationDTO getParent() {
    return parent;
  }

  public void setParent(OrganizationDTO parent) {
    this.parent = parent;
  }

  public OrganizationTypeDTO getOrganizationType() {
    return organizationType;
  }

  public void setOrganizationType(OrganizationTypeDTO organizationType) {
    this.organizationType = organizationType;
  }

  //@formatter:off
  @Override
  public String toString() {
    return "OrganizationDTO{" + 
              "id=" + getId() + 
              ", code='" + getCode() + "'" + 
              ", name='" + getName() + "'" + 
              ", image='" + getImage() + "'" + 
              ", inputInventory='" + getInputInventory() + "'" + 
              ", outputInventory='" + getOutputInventory() + "'" + 
              ", user=" + getUser() + 
              ", parent=" + getParent() + 
              ", organizationType=" + getOrganizationType() +
              ", sort=" + getSort() +
              ", version=" + getVersion() + 
           "}";
  }
  //@formatter:on
}
