package com.eactive.eai.rms.onl.apim.portalnotice;

import com.eactive.apim.portal.file.entity.FileInfo;
import com.eactive.eai.data.converter.LocalDateTimeFormatters;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;

import java.time.LocalDateTime;
import java.util.List;


@Data
public class PortalNoticeUI {

	public static final String NOTICE_TYPE_NORMAL = "1";
	public static final String NOTICE_TYPE_MAINTENANCE = "2";
	public static final String NOTICE_TYPE_INCIDENT = "3";

	private String id;

	private String noticeSubject;

	private String noticeDetail;

	private String fileId;

	private String fileName;

	private MultipartFile files;

	private FileInfo fileInfo;

	private Long readCount;

	private String useYn;

	private String inquirerName;
	
	private String fixYn;
	
	private String noticeType;
	

	private String createdBy;

	@JsonFormat(pattern = LocalDateTimeFormatters.FORMAT_YYYYMMDDHHMMSS_14)
	@DateTimeFormat(pattern = "yyyyMMddHHmmss")
	private LocalDateTime createdDate;

	private String lastModifiedBy;

	@JsonFormat(pattern = LocalDateTimeFormatters.FORMAT_YYYYMMDDHHMMSS_14)
	@DateTimeFormat(pattern = "yyyyMMddHHmmss")
	private LocalDateTime lastModifiedDate;

	private boolean hasAttachment;	// 첨부파일 여부

	private boolean fileDeleted; // 파일 삭제 여부

	// ───── 장애/점검(djb_apistatus_incident) 연동 필드 ─────
	private Long incidentId;

	private String summary;

	// HTML <input type="datetime-local"> 는 'T' 구분자 형식 (예: 2026-06-16T10:29).
	@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm")
	@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm")
	private LocalDateTime startedAt;

	@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm")
	@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm")
	private LocalDateTime endAt;

	private String state;          // INCIDENT 한정 (INVESTIGATING/IDENTIFIED/MONITORING/RESOLVED/CANCELED)

	private String previousState;  // 직전 상태

	private List<IncidentAffectedApiUI> affectedApis;
}
