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

import com.red.circle.framework.core.dto.PageCommand;
import java.io.Serial;
import java.time.LocalDate;
import java.util.Objects;

import com.red.circle.tool.core.text.StringUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author zongpubin on 2023/05/06 10:10
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class GameKtvConfigQryCmd extends PageCommand {

  @Serial
  private static final long serialVersionUID = 1L;

  /**
   * 歌曲id.
   */
  private Long songId;

  /**
   * 歌曲名称.
   */
  private String songName;

  /**
   * 归属系统.
   */
  private String sysOrigin;


  /**
   * 上传开始时间.
   */
  private String startCreateDate;

  /**
   * 上传结束时间.
   */
  private String endCreateDate;

  /**
   * false:下架、true：上架
   */
  private Boolean shelfStatus;

  /**
   * 排序方式.
   */
  private SortType sortType;

  /**
   * 区域.
   */
  private String region;

  public boolean isDesc() {
    return Objects.equals(sortType, SortType.DESC);
  }

  public boolean isAsc() {
    return Objects.equals(sortType, SortType.ASC);
  }

  enum SortType {
    DESC, ASC
  }
  public LocalDate getStartCreateDate() {
    if(StringUtils.isEmpty(this.startCreateDate)){
      return null;
    }
    return LocalDate.parse(this.startCreateDate);
  }

  public LocalDate getEndCreateDate() {
    if(StringUtils.isEmpty(this.endCreateDate)){
      return null;
    }
    return LocalDate.parse(this.endCreateDate);
  }
}
