package com.ruoyi.xq.notice.data;

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

import java.io.Serializable;

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

    private Integer type;

    private T data;

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


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