package com.jsowell.thirdparty.amap.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 高德地图通用返回类
 *
 * @author Lemon
 * @Date 2023/6/14 13:11
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AMapCommonResult {

    private AMapResponse response;

    /**
     * 成功响应
     * @param responseData
     * @return
     */
    public AMapCommonResult successResponse(Object responseData) {
        AMapResponse response = new AMapResponse();
        response.setCode("1000");
        response.setMsg("请求成功");
        response.setData(responseData);
        return new AMapCommonResult(response);
    }

    public AMapCommonResult failedResponse() {
        AMapResponse response = new AMapResponse();
        response.setCode("40004");
        response.setMsg("接口异常");
        return new AMapCommonResult(response);
    }

    public AMapCommonResult checkSignFailed() {
        AMapResponse response = new AMapResponse();
        response.setCode("40002");
        response.setMsg("验签错误，请检查！");
        return new AMapCommonResult(response);
    }
}
