/*
 * Decompiled with CFR 0.152.
 */
package org.jivesoftware.smack.compress.packet;

import java.util.Collections;
import java.util.List;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.FullStreamElement;
import org.jivesoftware.smack.util.XmlStringBuilder;

public class Compress
extends FullStreamElement {
    public static final String ELEMENT = "compress";
    public static final String NAMESPACE = "http://jabber.org/protocol/compress";
    public final String method;

    public Compress(String method) {
        this.method = method;
    }

    @Override
    public String getElementName() {
        return ELEMENT;
    }

    @Override
    public String getNamespace() {
        return NAMESPACE;
    }

    @Override
    public XmlStringBuilder toXML() {
        XmlStringBuilder xml = new XmlStringBuilder(this);
        xml.rightAngleBracket();
        xml.element("method", this.method);
        xml.closeElement(this);
        return xml;
    }

    public static class Feature
    implements ExtensionElement {
        public static final String ELEMENT = "compression";
        public final List<String> methods;

        public Feature(List<String> methods) {
            this.methods = methods;
        }

        public List<String> getMethods() {
            return Collections.unmodifiableList(this.methods);
        }

        @Override
        public String getNamespace() {
            return Compress.NAMESPACE;
        }

        @Override
        public String getElementName() {
            return ELEMENT;
        }

        @Override
        public XmlStringBuilder toXML() {
            XmlStringBuilder xml = new XmlStringBuilder(this);
            xml.rightAngleBracket();
            for (String method : this.methods) {
                xml.element("method", method);
            }
            xml.closeElement(this);
            return xml;
        }
    }
}
