package com.it.rattan.rpc;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.it.rattan.enums.RattanMark;
import lombok.Getter;
import lombok.Setter;

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@Getter
@Setter
public class RattanResponse<T> extends ObjectRestResponse<T> {


    public RattanResponse(T data) {
        super(data);
    }

    public RattanResponse(T data, String code, String msg) {
        super(data, code, msg);
    }

    public static RattanResponse<Object> success(){
        return new RattanResponse<>(RattanMark.NULL, SUCCESS,RattanMark.EMPTY);
    }

    public static RattanResponse<Object> success(Object data){
        return new RattanResponse<>(data, SUCCESS,RattanMark.EMPTY);
    }

    public static RattanResponse<Object> fail(String msg){
        return new RattanResponse<>(RattanMark.NULL, FAIL,msg);
    }
}
