package org.xbib.io.webdav.common;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xbib.io.webdav.api.DavConstants;

/**
 * <code>LabelSetProperty</code>...
 */
public class LabelSetProperty extends AbstractDavProperty<String[]> {

    private final String[] value;

    /**
     * Create a new <code>LabelSetProperty</code>.
     *
     * @param labels
     */
    public LabelSetProperty(String[] labels) {
        super(DavPropertyName.create("label-name-set", DavConstants.NAMESPACE), true);
        this.value = labels;
    }


    public String[] getValue() {
        return value;
    }

    @Override
    public Element toXml(Document document) {
        Element elem = getName().toXml(document);
        for (String str : value) {
            DomUtil.addChildElement(elem, "label-name", DavConstants.NAMESPACE, str);
        }
        return elem;
    }

}
