package go.kr.project.api.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * 공통 래퍼: { "data": [ ... ] }
 * VMIS-interface API 호출 시 사용하는 공통 Envelope 클래스
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@Getter
@Setter
public class Envelope<T> {

    @JsonProperty("data")
    private List<T> data = new ArrayList<>();

    public Envelope() {}

    public Envelope(T single) {
        if (single != null) this.data.add(single);
    }

    public Envelope(List<T> data) {
        this.data = data;
    }
}
