package com.swiftcleaner.chovey.model.bean;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;

public class SimilarBean {
    private String url;
    private String hashCode;
    private int avgPixel;
    private long size;
    private boolean isSelect;
    private String groupID; // 新增字段，用于标识分组
    private List<SimilarBean> items;

    // Constructor
    public SimilarBean(String url, String hashCode, int avgPixel, long size, boolean isSelect) {
        this.url = url;
        this.hashCode = hashCode;
        this.avgPixel = avgPixel;
        this.size = size;
        this.isSelect = isSelect;
        this.items = new ArrayList<>();
    }


    public void addItem(SimilarBean item) {
        this.items.add(item);
    };

    public SimilarBean(String groupID) {
        this.groupID = groupID;
    }

    public SimilarBean(List<SimilarBean> items) {
        this.items = items;
    }

    public String getGroupID() {
        return groupID;
    }

    public void setGroupID(String groupID) {
        this.groupID = groupID;
    }

    // Getters and Setters
    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getHashCode() {
        return hashCode;
    }

    public void setHashCode(String hashCode) {
        this.hashCode = hashCode;
    }

    public int getAvgPixel() {
        return avgPixel;
    }

    public void setAvgPixel(int avgPixel) {
        this.avgPixel = avgPixel;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public boolean isSelect() {
        return isSelect;
    }

    public void setSelect(boolean select) {
        isSelect = select;
    }

    public List<SimilarBean> getItems() {
        return items;
    }

    public void setItems(List<SimilarBean> items) {
        this.items = items;
    }

    // Method to add a SimilarBean to the list

    @Override
    public String toString() {
        return "SimilarBean{" +
                "id=" + getGroupID() +
                ", items=" + (items != null ? items.size() : "null") + // 避免递归
                "}";
    }
}