package lc.mecha.file;

import java.util.Objects;

/**
 * A simple POJO representing the file meta-information.
 *
 * @author Alex Leigh
 */
public class FileStat {
    private final String name;
    private final String type;
    private final long size;

    public FileStat(String name, String type, long size) {
        this.name = name;
        this.type = type;
        this.size = size;
    }

    public String getName() {
        return name;
    }

    public String getType() {
        return type;
    }

    public long getSize() {
        return size;
    }

    @Override
    public String toString() {
        return "FileStat{" +
                "name='" + name + '\'' +
                ", type='" + type + '\'' +
                ", size=" + size +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FileStat fileStat = (FileStat) o;
        return size == fileStat.size && Objects.equals(name, fileStat.name) && Objects.equals(type, fileStat.type);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, type, size);
    }
}
