package com.ruoyi.cai.notice.data;

import com.ruoyi.cai.notice.enums.MessageBaseTypeEnum;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
public class WindowNoticeR<T> implements Serializable {
    private static final long serialVersionUID = 1L;

    private Integer id;

    private T data;

    public static <T> WindowNoticeR<T> ok(MessageBaseTypeEnum typeEnum, T data) {
        return restResult(typeEnum.getCode(), data);
    }


    private static <T> WindowNoticeR<T> restResult(Integer type, T data) {
        WindowNoticeR<T> r = new WindowNoticeR<>();
        r.setId(type);
        r.setData(data);
        return r;
    }
}
