package com.red.circle.common.business.enums;


import com.red.circle.tool.core.date.TimestampUtils;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Objects;

/**
 * @author pengliang on 2020/1/11 10:27
 */
public enum AccountStatusEnum {

  /**
   * 正常.
   */
  NORMAL,
  /**
   * 冻结.
   */
  FREEZE,
  /**
   * 封存.
   */
  ARCHIVE,

  /**
   * 封禁账号+设备.
   */
  ARCHIVE_DEVICE;

  public static boolean isArchive(String status) {
    return Objects.equals(ARCHIVE.name(), status) || Objects.equals(ARCHIVE_DEVICE.name(), status);
  }

  public static boolean isFreeze(Timestamp freezingTime) {
    return Objects.nonNull(freezingTime)
        && freezingTime.after(TimestampUtils.now());
  }
}

