package xyz.stream.api.entity;

import java.util.HashMap;
import java.util.Map;
import xyz.stream.utils.h;
import xyz.stream.utils.m;

/* JADX INFO: loaded from: classes3.dex */
public class MobileBaseEntity {
    public static final String ERROR_CODE = "1001";
    public static final String SUCCESS_CODE = "0000";
    private String code;
    private Object data;
    private String msg;

    public MobileBaseEntity() {
    }

    public static String errorResult(String str) {
        MobileBaseEntity mobileBaseEntity = new MobileBaseEntity();
        mobileBaseEntity.setCode(ERROR_CODE);
        mobileBaseEntity.setMsg(str);
        return m.a(mobileBaseEntity);
    }

    private static Map<String, Object> getListData(Object obj) {
        HashMap map = new HashMap();
        map.put("list", obj);
        return map;
    }

    public static MobileBaseEntity parseJson(String str) {
        try {
            return (MobileBaseEntity) m.f36162a.fromJson(str, MobileBaseEntity.class);
        } catch (Exception e10) {
            h.c(e10.getMessage());
            return null;
        }
    }

    public static String successError(Object obj, String str) {
        MobileBaseEntity mobileBaseEntity = new MobileBaseEntity();
        mobileBaseEntity.setCode(SUCCESS_CODE);
        mobileBaseEntity.setData(obj);
        mobileBaseEntity.setMsg(str);
        return m.a(mobileBaseEntity);
    }

    public static String successList(Object obj) {
        MobileBaseEntity mobileBaseEntity = new MobileBaseEntity();
        mobileBaseEntity.setCode(SUCCESS_CODE);
        mobileBaseEntity.setData(getListData(obj));
        mobileBaseEntity.setMsg("success");
        return m.a(mobileBaseEntity);
    }

    public static String successResult(Object obj) {
        MobileBaseEntity mobileBaseEntity = new MobileBaseEntity();
        mobileBaseEntity.setCode(SUCCESS_CODE);
        mobileBaseEntity.setData(obj);
        mobileBaseEntity.setMsg("success");
        return m.a(mobileBaseEntity);
    }

    public String getCode() {
        return this.code;
    }

    public Object getData() {
        return this.data;
    }

    public String getMsg() {
        return this.msg;
    }

    public void setCode(String str) {
        this.code = str;
    }

    public void setData(Object obj) {
        this.data = obj;
    }

    public void setMsg(String str) {
        this.msg = str;
    }

    public MobileBaseEntity(String str, Object obj, String str2) {
        this.code = str;
        this.data = obj;
        this.msg = str2;
    }

    private static Map<String, Object> getListData(Object obj, int i10, int i11, int i12) {
        HashMap map = new HashMap();
        map.put("list", obj);
        map.put("cur_page", Integer.valueOf(i10));
        map.put("last_page", Integer.valueOf(i12 / i11));
        map.put("page_size", Integer.valueOf(i11));
        map.put("total", Integer.valueOf(i12));
        return map;
    }

    public static String successList(Object obj, int i10, int i11, int i12) {
        MobileBaseEntity mobileBaseEntity = new MobileBaseEntity();
        mobileBaseEntity.setCode(SUCCESS_CODE);
        mobileBaseEntity.setData(getListData(obj, i10, i11, i12));
        mobileBaseEntity.setMsg("success");
        return m.a(mobileBaseEntity);
    }
}
