package ru.ibs.socrates.confexporter.dao.dto;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Optional;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Data;


@Data
public class ProjectDaoDto {
  
  private ProjectId projectId;

  private String sourceId;
  
  private String title;
  
  private String comment;
  
  @Data
  @AllArgsConstructor
  public static class ProjectId {
    
    @JsonValue
    private UUID entityId;

    @JsonCreator
    public static ProjectId of(UUID entityId) {
      return Optional.ofNullable(entityId)
          .map(ProjectId::new)
          .orElse(null);
    }
  }
}
