from parallels.core import safe_format
from parallels.core.connections.source_server import SourceServer
from parallels.plesk.source.plesk import messages


class PleskSourceRemoteSmarterMailServer(SourceServer):
    def __init__(self, source_id, settings):
        """
        :type source_id: str | unicode
        :type settings: parallels.core.migrator_config.SourceWindowsServerConfig
        """
        super(PleskSourceRemoteSmarterMailServer, self).__init__(source_id, settings)

    def description(self):
        """Return brief server description which should help end customer
        to identify server and which should be used in all messages

        :rtype: str | unicode
        """
        return safe_format(messages.SOURCE_REMOTE_SMARTER_MAIL_DESCRIPTION, ip=self.ip())

    def __hash__(self):
        return hash(self.ip())

    def __eq__(self, another):
        return isinstance(another, PleskSourceRemoteSmarterMailServer) and another.ip() == self.ip()