package com.red.circle.other.app.dto.cmd.user;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.red.circle.framework.core.dto.CommonCommand;
import com.red.circle.other.inner.enums.sys.appmanager.ManagerApprovalType;
import jakarta.validation.constraints.NotNull;
import java.util.Objects;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 资料审批.
 *
 * @author pengliang on 2021/4/6
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class ManagerApprovalCmd extends CommonCommand {

  /**
   * 审批类型.
   *
   * @eo.required
   */
  @NotNull(message = "type required.")
  private ManagerApprovalType type;

  /**
   * 被审批用户id.
   *
   * @eo.required
   */
  @NotNull(message = "beApprovalUserId required.")
  private Long beApprovalUserId;

  /**
   * 内容id.
   */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long contentId;

  /**
   * 内容.
   */
  private String content;

  public boolean checkApprovalUserAvatar() {
    return Objects.equals(getType(), ManagerApprovalType.USER_AVATAR);
  }

  public boolean checkApprovalUserNickname() {
    return Objects.equals(getType(), ManagerApprovalType.USER_NICKNAME);
  }

  public boolean checkApprovalUserAccountFreeze() {
    return Objects.equals(getType(), ManagerApprovalType.USER_ACCOUNT_FREEZE);
  }

  public boolean checkUnblockAccount() {
    return Objects.equals(getType(), ManagerApprovalType.UNBLOCK_ACCOUNT);
  }

  public boolean checkApprovalUserAccountArchive() {
    return Objects.equals(getType(), ManagerApprovalType.USER_ACCOUNT_ARCHIVE);
  }

  public boolean checkApprovalRoomCover() {
    return Objects.equals(getType(), ManagerApprovalType.ROOM_COVER);
  }

  public boolean checkApprovalRoomNickname() {
    return Objects.equals(getType(), ManagerApprovalType.ROOM_NICKNAME);
  }

  public boolean checkApprovalRoomNotice() {
    return Objects.equals(getType(), ManagerApprovalType.ROOM_NOTICE);
  }

}
