package ch.usi.inf.sp.callgraph.renderer;

import java.util.Map;
import java.util.Objects;

public class ClassToMethodEdge implements DotEdge {
    private final DotClassNode from;
    private final DotMethodNode to;

    public ClassToMethodEdge(DotClassNode from, DotMethodNode to) {
        this.from = from;
        this.to = to;
    }

    public DotClassNode getFrom() {
        return from;
    }

    public DotMethodNode getTo() {
        return to;
    }

    @Override
    public Map<String, String> getProperties() {
        return Map.of(
                "style", "solid",
                "color", "lightgreen"
        );
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ClassToMethodEdge that = (ClassToMethodEdge) o;
        return Objects.equals(from, that.from) && Objects.equals(to, that.to);
    }

    @Override
    public int hashCode() {
        return Objects.hash(from, to);
    }
}
