package com.red.circle.other.inner.model.cmd.approval;

import com.red.circle.common.business.core.enums.DataApprovalTypeEnum;
import com.red.circle.framework.dto.Command;
import com.red.circle.tool.core.collection.CollectionUtils;
import jakarta.validation.constraints.NotNull;
import java.io.Serial;
import java.util.List;
import java.util.Objects;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * 资料审核内容.
 *
 * @author pengliang on 2024/1/18
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class ProfileApprovalContentCmd extends Command {

  @Serial
  private static final long serialVersionUID = 1L;

  /**
   * 被审核用户id.
   */
  @NotNull(message = "beUserId required.")
  private Long beUserId;

  /**
   * 来源系统.
   */
  @NotNull(message = "sysOrigin required.")
  private String sysOrigin;

  /**
   * 审核类型.
   */
  @NotNull(message = "approvalType required.")
  private DataApprovalTypeEnum approvalType;

  /**
   * 被审核内容.
   */
  @NotNull(message = "contents required.")
  private List<ProfileContentCmd> contents;

  public ProfileApprovalContentCmd addContent(Long id, String content) {
    if (Objects.isNull(contents)) {
      contents = CollectionUtils.newArrayList();
    }
    contents.add(new ProfileContentCmd()
        .setId(id)
        .setContent(content)
    );
    return this;
  }

}
