package incheon.ags.dtad.vo;


import java.sql.Timestamp;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * @Class Name : DtadBizVO.java
 * @Description : dtad VO class
 * @Modification Information
 * @
 * @  수정일         수정자                   수정내용
 * @ -------    --------    ---------------------------
 * @ 2026.01.21    이진주          최초 생성
 *
 *  @author (주)올포랜드 이진주
 *  @since 2026.01.21
 *  @version 1.0
 *  @see
 *  
 */
@Schema(description = "수치지형도 관리자 페이지 - 사업정보관리VO")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class DtadBizVO {
	
	@Schema(description = "변경일련번호")
	private Integer bizSn; 
	
	@Schema(description = "변경구분")
	private String bizSe;
	
	@Schema(description = "갱신일자")
	private Timestamp updtYmd;
	
	@Schema(description = "사업명")
	private String bizNm;
	
	@Schema(description = "사업종료일")
	private Timestamp bizEndYmd;
	
	@Schema(description = "사업시작일")
	private Timestamp bizBgngYmd; 
	
	@Schema(description = "사업년도")
	private String bizYr;
	
	@Schema(description = "사업설명")
	private String bizExpln; 
	
	@Schema(description = "사업금액")
	private Integer bizAmt;
	
	@Schema(description = "설계금액")
	private Integer designAmt;
	
	@Schema(description = "총공사비")
	private Integer lastAmt;

	@Schema(description = "사업기관명")
	private String bizInstNm; 
	
	@Schema(description = "주사업자")
	private String mbpr;

	@Schema(description = "등록자아이디")
	private String frstRegId;
	
	@Schema(description = "등록일자")
	private Timestamp frstRegDt;
	
	@Schema(description = "수정자아이디")
	private String lastMdfcnId;
	
	@Schema(description = "수정일자")
	private Timestamp lastMdfcnDt;

	@Schema(description = "고시번호")
	private String ancmntNo; 
	
	
	
	//페이지네이션
	@Schema(description = "현재페이지")
	private Integer pageIndex = 1;
	
	@Schema(description = "페이지갯수")
	private Integer pageUnit = 10;

	@Schema(description = "시작 인덱스")
	private Integer firstIndex = 0;
	
	@Schema(description = "마지막 인덱스")
	private Integer lastIndex = 1;
	
	@Schema(description = "페이지 시작번호")
	private Integer startPage; 
	
	@Schema(description = "recordCountPerPage")
	private Integer recordCountPerPage = 10;
	
	@Schema(description = "총 페이지 수")
	private Integer totalPage;
	
	@Schema(description = "총 개수")
	private Integer totalCount;

	@Schema(description = "총 개수")
	public void setPageInfo(int totalCount) {
		// DB OFFSET 계산
		this.firstIndex = (pageIndex - 1) * recordCountPerPage;
		// 전체 페이지 수
		this.totalPage = (int) Math.ceil((double) totalCount / recordCountPerPage);
		// 현재 묶음 시작 페이지
		this.startPage = ((pageIndex - 1) / 10) * 10 + 1;
		// 현재 묶음 마지막 페이지
		this.lastIndex = Math.min(startPage + pageUnit - 1, totalPage);
		
		this.totalCount = totalCount;
	}

	//사용자정보
	@Schema(description = "사용자명")
	private String userNm;
	
	@Schema(description = "사용자아이디")
	private String userId;
	
	@Schema(description = "사용자 고유 아이디 (PK)")
	private String userUnqId;
}
