package com.oguerreiro.resilient.service.dto;

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

/**
 * A DTO for the {@link com.oguerreiro.resilient.domain.MetadataValue} entity.
 */
@Schema(description = "Metadata Value\nThe value of a metadata property.")
public class MetadataValueDTO extends AbstractResilientDTO<Long> {
  private static final long serialVersionUID = 1L;

  @NotNull
  @Schema(description = "Functional relational key to MetadataProperty", requiredMode = Schema.RequiredMode.REQUIRED)
  private String metadataPropertyCode;

  @NotNull
  @Schema(description = "The target domain key that this MetadataValue belongs. Its a class name or a key provided by the consumer. <br>\nUsed with targetDomainId to create as unique relation with the target domain\n@see targetDomainId", requiredMode = Schema.RequiredMode.REQUIRED)
  private String targetDomainKey;

  @NotNull
  @Schema(description = "The target domain Id that this MetadataValue belongs. <br>\nUsed with targetDomainKey to create as unique relation with the target domain\n@see targetDomainKey", requiredMode = Schema.RequiredMode.REQUIRED)
  private Long targetDomainId;

  @Schema(description = "The value of the MetadataProperty, persisted as a string. <br>")
  private String value;

  public String getMetadataPropertyCode() {
    return metadataPropertyCode;
  }

  public void setMetadataPropertyCode(String metadataPropertyCode) {
    this.metadataPropertyCode = metadataPropertyCode;
  }

  public String getTargetDomainKey() {
    return targetDomainKey;
  }

  public void setTargetDomainKey(String targetDomainKey) {
    this.targetDomainKey = targetDomainKey;
  }

  public Long getTargetDomainId() {
    return targetDomainId;
  }

  public void setTargetDomainId(Long targetDomainId) {
    this.targetDomainId = targetDomainId;
  }

  public String getValue() {
    return value;
  }

  public void setValue(String value) {
    this.value = value;
  }

  //@formatter:off
  @Override
  public String toString() {
    return "MetadataValueDTO{" + 
              "id=" + getId() + 
              ", metadataPropertyCode='" + getMetadataPropertyCode() + "'" + 
              ", targetDomainKey='" + getTargetDomainKey() + "'" + 
              ", targetDomainId=" + getTargetDomainId() + 
              ", value='" + getValue() + "'" + 
              ", version=" + getVersion() + 
           "}";
  }
  //@formatter:on
}
