/*
 * Copyright (C) 2017 LibreCCM Foundation.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301  USA
 */
package org.libreccm.admin.ui;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 *
 * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
 */
public class SitesTableRowData implements Comparable<SitesTableRowData>, Serializable {

    private static final long serialVersionUID = 4023882563583816258L;

    private long siteId;

    private String domainOfSite;

    private boolean defaultSite;

    private String defaultTheme;

    private boolean deletable;

    private List<String> applications;

    protected SitesTableRowData() {
        applications = new ArrayList<>();
    }

    public long getSiteId() {
        return siteId;
    }

    public void setSiteId(final long siteId) {
        this.siteId = siteId;
    }

    public String getDomainOfSite() {
        return domainOfSite;
    }

    public void setDomainOfSite(final String domainOfSite) {
        this.domainOfSite = domainOfSite;
    }

    public boolean isDefaultSite() {
        return defaultSite;
    }

    public void setDefaultSite(final boolean defaultSite) {
        this.defaultSite = defaultSite;
    }

    public String getDefaultTheme() {
        return defaultTheme;
    }

    public void setDefaultTheme(final String defaultTheme) {
        this.defaultTheme = defaultTheme;
    }

    public boolean isDeletable() {
        return deletable;
    }

    public void setDeletable(final boolean deletable) {
        this.deletable = deletable;
    }

    public List<String> getApplications() {
        return Collections.unmodifiableList(applications);
    }

    protected void setApplications(final List<String> applications) {
        this.applications = new ArrayList<>(applications);
    }

    protected void addApplication(final String application) {
        applications.add(application);
    }

    @Override
    public int compareTo(final SitesTableRowData other) {
        return domainOfSite.compareTo(other.getDomainOfSite());
    }

}
