package cn.palmte.work.model.process;

import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;

import cn.palmte.work.model.Project;
import cn.palmte.work.model.ProjectBudgetIncomeDetail;
import cn.palmte.work.model.enums.CooperationType;
import cn.palmte.work.model.enums.ProjectType;
import lombok.Data;

/**
 * @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
 * @since 2.0 2022/12/30 00:11
 */
@Data
public class ProjectProcessDetail {

  private Integer processId;

  private Project project;
  private ProjectProcess process;
  private ProjectType projectType;

  private String projectTypeDesc;

  private CooperationType cooperationType;
  private String cooperationTypeDesc;

  private List<ProcessAttachment> attachments;

  private String isPrepaid;
  private BigDecimal repaidAmount;
  private BigDecimal budgetGrossMargin;

  private Object contract;

  public List<ProjectBudgetIncomeDetail> incomeDetails;

  public List<SupplierMaterial> supplierMaterials;
  public List<ProcurementDetail> procurementDetails;

  public BigDecimal contractAmount;

  public void setCooperationType(CooperationType cooperationType) {
    this.cooperationType = cooperationType;
    this.cooperationTypeDesc = Optional.ofNullable(cooperationType)
            .map(CooperationType::getDescription)
            .orElse(null);
  }

  public void setProjectType(ProjectType projectType) {
    this.projectType = projectType;
    this.projectTypeDesc = Optional.ofNullable(projectType).
            map(ProjectType::getDescription)
            .orElse(null);
  }
}
