package com.inspect.partrolresult.domain;

import com.alibaba.fastjson.JSONObject;
import com.inspect.analysis.constant.AnalyseConstants;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;

@Setter
@Getter
public class AnalyseReqItem implements Serializable {
    private String objectId;
    private String imageNormalUrlPath;
    private String[] typeList;
    private String[] imageUrlList;
    private String[] dronePoseList;

    public AnalyseReqItem clone() {
        return JSONObject.parseObject(JSONObject.toJSONString(this), AnalyseReqItem.class);
    }

    public String toResultValue(String type) {
        return this.objectId + AnalyseConstants.ANALYSE_SPLIT + type;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;
        AnalyseReqItem that = (AnalyseReqItem) object;
        return Objects.equals(objectId, that.objectId) && Objects.equals(imageNormalUrlPath, that.imageNormalUrlPath) && Objects.deepEquals(typeList, that.typeList) && Objects.deepEquals(imageUrlList, that.imageUrlList);
    }

    @Override
    public int hashCode() {
        return Objects.hash(objectId, imageNormalUrlPath, Arrays.hashCode(typeList), Arrays.hashCode(imageUrlList));
    }

    @Override
    public String toString() {
        return "AnalyseReqItem{" +
                "objectId='" + objectId + '\'' +
                ", imageNormalUrlPath='" + imageNormalUrlPath + '\'' +
                ", typeList=" + Arrays.toString(typeList) +
                ", imageUrlList=" + Arrays.toString(imageUrlList) +
                '}';
    }
}
