package com.xiaoniu.subsystem.strategy.bean;

import lombok.Data;

import java.util.List;

@Data
public class FileDir{
    /**
     * 类型，1：目录；2：文件；
     */
    private Integer docType=1;
    /**
     * 目录名称
     */
    private String docName;
    /**
     * 目录级别，根目录为1，其子目录依次递增
     */
    private Integer level;
    /**
     * 父级目录名称
     */
    private String parentDocName;
    /**
     * 目录唯一标识
     */
    private Long id;
    /**
     * 父级目录唯一标识
     */
    private Long parentId;
    /**
     * 当前节点的孩子节点
     */
    private List<FileDir> children;
    /**
     * 压缩包内文件全路径
     */
    private String filePath;
    /**
     * 存储路径
     */
    private String ossLocation;
    /**
     * 上传任务id
     */
    private String uploadTaskId;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        FileDir fileDir = (FileDir) o;

        if (docType != null ? !docType.equals(fileDir.docType) : fileDir.docType != null) return false;
        if (docName != null ? !docName.equals(fileDir.docName) : fileDir.docName != null) return false;
        if (level != null ? !level.equals(fileDir.level) : fileDir.level != null) return false;
        if (parentDocName != null ? !parentDocName.equals(fileDir.parentDocName) : fileDir.parentDocName != null)
            return false;
        if (id != null ? !id.equals(fileDir.id) : fileDir.id != null) return false;
        if (parentId != null ? !parentId.equals(fileDir.parentId) : fileDir.parentId != null) return false;
        if (children != null ? !children.equals(fileDir.children) : fileDir.children != null) return false;
        if (filePath != null ? !filePath.equals(fileDir.filePath) : fileDir.filePath != null) return false;
        if (ossLocation != null ? !ossLocation.equals(fileDir.ossLocation) : fileDir.ossLocation != null) return false;
        return uploadTaskId != null ? uploadTaskId.equals(fileDir.uploadTaskId) : fileDir.uploadTaskId == null;
    }

    @Override
    public int hashCode() {
        int result = docType != null ? docType.hashCode() : 0;
        result = 31 * result + (docName != null ? docName.hashCode() : 0);
        result = 31 * result + (level != null ? level.hashCode() : 0);
        result = 31 * result + (parentDocName != null ? parentDocName.hashCode() : 0);
        result = 31 * result + (id != null ? id.hashCode() : 0);
        result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
        result = 31 * result + (children != null ? children.hashCode() : 0);
        result = 31 * result + (filePath != null ? filePath.hashCode() : 0);
        result = 31 * result + (ossLocation != null ? ossLocation.hashCode() : 0);
        result = 31 * result + (uploadTaskId != null ? uploadTaskId.hashCode() : 0);
        return result;
    }
}
