from dataclasses import dataclass


@dataclass
class Service:
    type: str
    name: str
    address: str
    port: int

    def __hash__(self):
        return hash((self.type, self.name, self.address, self.port))

    def __eq__(self, other):
        if not isinstance(other, Service):
            return False

        return (
                self.type == other.type and
                self.name == other.name and
                self.address == other.address and
                self.port == other.port
        )
