package com.oqpo.api.web.dto.response.oper.ntice;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.oqpo.api.entity.oper.NticeEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

@Getter
@Setter
@Builder
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@JsonInclude(JsonInclude.Include.ALWAYS) //null 값 전송
public class NkMNticeListResponse {

    @ApiModelProperty(value = "순번")
    private String rnum;
    @ApiModelProperty(value = "공지번호")
    private String nticeNo;
    @ApiModelProperty(value = "공지명")
    private String nticeTitl;
    @ApiModelProperty(value = "공지일")
    private String notiStDay;

    public static NkMNticeListResponse toDTO(NticeEntity entity) {
        if (entity == null) return null;
        return NkMNticeListResponse.builder()
                .rnum(entity.getRnum())
                .nticeNo(entity.getNticeNo())
                .nticeTitl(entity.getNticeTitl())
                .notiStDay(entity.getNotiStDay())
                .build();
    }

}
