package net.ranides.test.adapter.model0;

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

public class Image0 implements Serializable {

    private String id;

    private int x;

    private int y;

    public Image0(String id, int x, int y) {
        this.id = id;
        this.x = x;
        this.y = y;
    }

    public String getId() {
        return id;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    void setX(int x) {
        this.x = x;
    }

    void setY(int y) {
        this.y = y;
    }

    public boolean atLocation(Image0 image) {
        return atLocation(image.x, image.y);
    }

    public boolean atLocation(int x, int y) {
        return this.x == x && this.y == y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Image0 image0 = (Image0) o;
        return x == image0.x && y == image0.y && Objects.equals(id, image0.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, x, y);
    }

    @Override
    public String toString() {
        return String.format("%d:%d:%s", x, y, id);
    }
}
