package org.jxmpp.jid.impl;

import org.jxmpp.jid.BareJid;
import org.jxmpp.jid.DomainBareJid;
import org.jxmpp.jid.DomainFullJid;
import org.jxmpp.jid.FullJid;
import org.jxmpp.jid.Jid;
import org.jxmpp.jid.JidWithLocalpart;
import org.jxmpp.jid.JidWithResource;
import org.jxmpp.jid.parts.Domainpart;
import org.jxmpp.jid.parts.Localpart;
import org.jxmpp.jid.parts.Resourcepart;
import org.jxmpp.stringprep.XmppStringprepException;

public class DomainpartJid extends AbstractJid implements DomainBareJid {
   protected final Domainpart domain;

   DomainpartJid(String domain) throws XmppStringprepException {
      this(Domainpart.from(domain));
   }

   DomainpartJid(Domainpart domain) {
      this.domain = domain;
   }

   public Domainpart getDomain() {
      return this.domain;
   }

   public String toString() {
      return this.domain.toString();
   }

   public String asUnescapedString() {
      return this.toString();
   }

   public DomainBareJid asDomainBareJid() {
      return this;
   }

   public boolean hasNoResource() {
      return true;
   }

   public BareJid asBareJidIfPossible() {
      return null;
   }

   public FullJid asFullJidIfPossible() {
      return null;
   }

   public DomainBareJid asDomainBareJidIfPossible() {
      return this.asDomainBareJid();
   }

   public DomainFullJid asDomainFullJidIfPossible() {
      return null;
   }

   public boolean isParentOf(BareJid bareJid) {
      return this.domain.equals(bareJid.getDomain());
   }

   public boolean isParentOf(FullJid fullJid) {
      return this.domain.equals(fullJid.getDomain());
   }

   public boolean isParentOf(DomainBareJid domainBareJid) {
      return this.domain.equals(domainBareJid.getDomain());
   }

   public boolean isParentOf(DomainFullJid domainFullJid) {
      return this.domain.equals(domainFullJid.getDomain());
   }

   public Jid withoutResource() {
      return this;
   }

   public Localpart maybeGetLocalpart() {
      return null;
   }

   public Resourcepart maybeGetResourcepart() {
      return null;
   }

   public JidWithLocalpart asJidWithLocalpartIfPossible() {
      return null;
   }

   public JidWithResource asJidWithResourcepartIfPossible() {
      return null;
   }
}
