package incheon.cmm.g2f.layer.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;

import incheon.com.cmm.ComDefaultVO;

import java.io.Serial;

@EqualsAndHashCode(callSuper = true)
@lombok.Getter @lombok.Setter
@Schema(description = "업무 레이어 검색 요청")
public class TaskLayerSearchRequestDTO extends ComDefaultVO {

	@Serial
	private static final long serialVersionUID = -1724035129495604317L;

	@Schema(description = "업무 레이어 ID")
	Integer taskLyrId;

	@Schema(description = "업무 레이어 이름")
	String taskLyrNm;

	@Schema(description = "레이어 그룹 코드")
	String lyrGroupCd;

	@Schema(description = "레이어 대분류 코드")
	String lyrLclsfCd;

	@Schema(description = "레이어 중분류 코드")
	String lyrMclsfCd;

	@Schema(description = "레이어 소분류 코드")
	String lyrSclsfCd;

	@Schema(description = "좌표계", example = "5186")
	String cntm;

	@Schema(description = "공간 타입", example = "MULTIPOLYGON")
	String spceTy;

	@Schema(description = "검색 단어")
	private String searchKeyword;

	@Schema(description = "정렬 컬럼", example = "task_lyr_nm")
    private String sortColumn = "task_lyr_nm";

	@Schema(description = "정렬 방향", example = "ASC")
    private String sortDirection = "ASC";

	@Schema(description = "페이지 크기", example = "10")
    private int pageSize = 0;

	@Schema(description = "권한 체크", example = "true")
	private Boolean skipAuthorization = true;

	@Schema(description = "view 테이블 제외 여부", example = "false")
	private Boolean excludeView = false;

    public int getOffset() {
        return (getPageIndex() - 1) * getPageSize();
    }

	public void setTaskLyrNm(String taskLyrNm){
		this.taskLyrNm = taskLyrNm;
		this.searchKeyword = taskLyrNm;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
