package com.oguerreiro.resilient.service.dto;

import java.time.Instant;

import com.oguerreiro.resilient.domain.enumeration.PeriodVersionStatus;

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

/**
 * A DTO for the {@link com.oguerreiro.resilient.domain.PeriodVersion} entity.
 */
@Schema(description = "Period versions\nAlways have at least one version.")
public class PeriodVersionDTO extends AbstractResilientDTO<Long> {
  private static final long serialVersionUID = 1L;

  @NotNull
  @Schema(description = "Name of the version", requiredMode = Schema.RequiredMode.REQUIRED)
  private String name;

  @Schema(description = "Description for the version")
  private String description;

  @NotNull
  @Schema(description = "Period version (sequencial)", requiredMode = Schema.RequiredMode.REQUIRED)
  private Integer periodVersion;

  @NotNull
  @Schema(description = "State of the Period", requiredMode = Schema.RequiredMode.REQUIRED)
  private PeriodVersionStatus state;

  @NotNull
  @Schema(description = "The creation date (insert). When the data was inserted into the system.", requiredMode = Schema.RequiredMode.REQUIRED)
  private Instant creationDate;

  @NotNull
  @Schema(description = "The actual username logged into the system, that inserted the data. NOT a reference to the user, but the login username.", requiredMode = Schema.RequiredMode.REQUIRED)
  private String creationUsername;

  private PeriodDTO period;

  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 Integer getPeriodVersion() {
    return periodVersion;
  }

  public void setPeriodVersion(Integer periodVersion) {
    this.periodVersion = periodVersion;
  }

  public PeriodVersionStatus getState() {
    return state;
  }

  public void setState(PeriodVersionStatus state) {
    this.state = state;
  }

  public Instant getCreationDate() {
    return creationDate;
  }

  public void setCreationDate(Instant creationDate) {
    this.creationDate = creationDate;
  }

  public String getCreationUsername() {
    return creationUsername;
  }

  public void setCreationUsername(String creationUsername) {
    this.creationUsername = creationUsername;
  }

  public PeriodDTO getPeriod() {
    return period;
  }

  public void setPeriod(PeriodDTO period) {
    this.period = period;
  }

  //@formatter:off
  @Override
  public String toString() {
    return "PeriodVersionDTO{" + 
              "id=" + getId() + 
              ", name='" + getName() + "'" + 
              ", description='" + getDescription() + "'" + 
              ", periodVersion=" + getPeriodVersion() + 
              ", state='" + getState() + "'" + 
              ", creationDate='" + getCreationDate() + "'" + 
              ", creationUsername='" + getCreationUsername() + "'" + 
              ", version=" + getVersion() + 
              ", period=" + getPeriod() + 
           "}";
  }
  //@formatter:on
}
