package com.shulead.datasync.portalprice;

import org.apache.axis.description.ElementDesc;
import org.apache.axis.description.TypeDesc;
import org.apache.axis.encoding.Deserializer;
import org.apache.axis.encoding.Serializer;
import org.apache.axis.encoding.ser.BeanDeserializer;
import org.apache.axis.encoding.ser.BeanSerializer;

import javax.xml.namespace.QName;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * @Classname Result
 * @Description TODO
 * @Version 1.0.0
 * @Date 2024/4/28 18:38
 * @Created by liuxiangshun
 */
public class Result implements Serializable {
    private String code;
    private Integer count;
    private String errorInfo;
    private String msg;
    private Object[] result;
    private Object __equalsCalc = null;
    private boolean __hashCodeCalc = false;
    private static TypeDesc typeDesc = new TypeDesc(Result.class, true);

    static {
        typeDesc.setXmlType(new QName("http://webservice.promotions.cos.rise.com/", "result"));
        ElementDesc elemField = new ElementDesc();
        elemField.setFieldName("code");
        elemField.setXmlName(new QName("", "code"));
        elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new ElementDesc();
        elemField.setFieldName("count");
        elemField.setXmlName(new QName("", "count"));
        elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "int"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new ElementDesc();
        elemField.setFieldName("errorInfo");
        elemField.setXmlName(new QName("", "errorInfo"));
        elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new ElementDesc();
        elemField.setFieldName("msg");
        elemField.setXmlName(new QName("", "msg"));
        elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new ElementDesc();
        elemField.setFieldName("result");
        elemField.setXmlName(new QName("", "result"));
        elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "anyType"));
        elemField.setMinOccurs(0);
        elemField.setNillable(true);
        elemField.setMaxOccursUnbounded(true);
        typeDesc.addFieldDesc(elemField);
    }

    public Result() {
    }

    public Result(String code, Integer count, String errorInfo, String msg, Object[] result) {
        this.code = code;
        this.count = count;
        this.errorInfo = errorInfo;
        this.msg = msg;
        this.result = result;
    }

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

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

    public Integer getCount() {
        return this.count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public String getErrorInfo() {
        return this.errorInfo;
    }

    public void setErrorInfo(String errorInfo) {
        this.errorInfo = errorInfo;
    }

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

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

    public Object[] getResult() {
        return this.result;
    }

    public void setResult(Object[] result) {
        this.result = result;
    }

    public Object getResult(int i) {
        return this.result[i];
    }

    public void setResult(int i, Object _value) {
        this.result[i] = _value;
    }

    public synchronized boolean equals(Object obj) {
        if (!(obj instanceof Result)) {
            return false;
        } else {
            Result other = (Result)obj;
            if (obj == null) {
                return false;
            } else if (this == obj) {
                return true;
            } else if (this.__equalsCalc != null) {
                return this.__equalsCalc == obj;
            } else {
                this.__equalsCalc = obj;
                boolean _equals = (this.code == null && other.getCode() == null || this.code != null && this.code.equals(other.getCode())) && (this.count == null && other.getCount() == null || this.count != null && this.count.equals(other.getCount())) && (this.errorInfo == null && other.getErrorInfo() == null || this.errorInfo != null && this.errorInfo.equals(other.getErrorInfo())) && (this.msg == null && other.getMsg() == null || this.msg != null && this.msg.equals(other.getMsg())) && (this.result == null && other.getResult() == null || this.result != null && Arrays.equals(this.result, other.getResult()));
                this.__equalsCalc = null;
                return _equals;
            }
        }
    }

    public synchronized int hashCode() {
        if (this.__hashCodeCalc) {
            return 0;
        } else {
            this.__hashCodeCalc = true;
            int _hashCode = 1;
            if (this.getCode() != null) {
                _hashCode += this.getCode().hashCode();
            }

            if (this.getCount() != null) {
                _hashCode += this.getCount().hashCode();
            }

            if (this.getErrorInfo() != null) {
                _hashCode += this.getErrorInfo().hashCode();
            }

            if (this.getMsg() != null) {
                _hashCode += this.getMsg().hashCode();
            }

            if (this.getResult() != null) {
                for(int i = 0; i < Array.getLength(this.getResult()); ++i) {
                    Object obj = Array.get(this.getResult(), i);
                    if (obj != null && !obj.getClass().isArray()) {
                        _hashCode += obj.hashCode();
                    }
                }
            }

            this.__hashCodeCalc = false;
            return _hashCode;
        }
    }

    public static TypeDesc getTypeDesc() {
        return typeDesc;
    }

    public static Serializer getSerializer(String mechType, Class _javaType, QName _xmlType) {
        return new BeanSerializer(_javaType, _xmlType, typeDesc);
    }

    public static Deserializer getDeserializer(String mechType, Class _javaType, QName _xmlType) {
        return new BeanDeserializer(_javaType, _xmlType, typeDesc);
    }
}
