package com.malk.server.teambition;

import com.malk.server.common.McException;
import com.malk.server.common.VenR;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class TBR<T> extends VenR {

    private String code;

    private String errorMessage;

    /**
     * 接口返回数据
     */
    private T result;

    // 成功状态标记
    private final static String SUC_CODE = "200";

    // ppExt: 204为重复修改或tb设置了不允许修改规则
    private final static String NOR_CODE = "204";

    private String nextPageToken;

    private long totalSize;

    /**
     * 断言错误信息
     */
    @Override
    public void assertSuccess() {
        McException.assertException(!(code.equals(SUC_CODE) || code.equals(NOR_CODE)), code, errorMessage, "TB");
    }
}
