// Path: src/main/java/crawlercommons/sitemaps/extension/Extension.java
// public enum Extension {
//     /**
//      * Google News sitemaps, see
//      * https://support.google.com/news/publisher-center/answer/74288
//      */
//     NEWS,
//     /**
//      * Google Image sitemaps, see
//      * https://support.google.com/webmasters/answer/178636
//      */
//     IMAGE,
//     /**
//      * Google Video sitemaps, see
//      * https://support.google.com/webmasters/answer/80471
//      */
//     VIDEO,
//     /**
//      * Usage of <code>&lt;xhtml:links&gt;</code> in sitemaps to include
//      * localized page versions/variants, see
//      * https://support.google.com/webmasters/answer/189077
//      */
//     LINKS,
//     /**
//      * <cite>Mobile sitemaps just contain an empty "mobile" tag to identify a
//      * URL as having mobile content</cite>, cf.
//      * http://www.google.com/schemas/sitemap-mobile/1.0
//      */
//     MOBILE
// }
// 
// Path: src/main/java/crawlercommons/sitemaps/extension/ExtensionMetadata.java
// @SuppressWarnings("serial")
// public abstract class ExtensionMetadata implements Serializable {
// 
//     public abstract boolean equals(Object other);
// 
//     public abstract Map<String, String[]> asMap();
// 
//     public boolean isValid() {
//         return true;
//     }
// 
//     /**
//      * Compare URLs by their string representation because calling
//      * {@link URL#equals(Object)} may trigger an unwanted and potentially slow
//      * DNS lookup to resolve the host part
//      */
//     protected static boolean urlEquals(URL a, URL b) {
//         return (a == b) || (a != null && b != null && a.toString().equals(b.toString()));
//     }
// 
// }


import crawlercommons.sitemaps.extension.ExtensionMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.ZonedDateTime;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import crawlercommons.sitemaps.extension.Extension;
/**
 * Copyright 2016 Crawler-Commons
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package crawlercommons.sitemaps;




/**
 * The SitemapUrl class represents a URL found in a Sitemap.
 * 
 * @author fmccown
 */
@SuppressWarnings("serial")
public class SiteMapURL implements Serializable {
    private static final Logger LOG = LoggerFactory.getLogger(SiteMapURL.class);
    public static final double DEFAULT_PRIORITY = 0.5;

    /**
     * Allowed change frequencies
     */
    public enum ChangeFrequency {
        ALWAYS, HOURLY, DAILY, WEEKLY, MONTHLY, YEARLY, NEVER
    }

    ;

    /**
     * URL found in Sitemap (required)
     */
    private URL url;

    /**
     * When URL was last modified (optional)
     */
    private Date lastModified;

    /**
     * How often the URL changes (optional)
     */
    private ChangeFrequency changeFreq;

    /**
     * Value between [0.0 - 1.0] (optional)
     */
    private double priority = DEFAULT_PRIORITY;

    /**
     * could be false, if URL isn't found under base path as indicated here:
     * http://www.sitemaps.org/protocol.html#location *
     */
// Path: src/main/java/crawlercommons/sitemaps/extension/Extension.java
// public enum Extension {
//     /**
//      * Google News sitemaps, see
//      * https://support.google.com/news/publisher-center/answer/74288
//      */
//     NEWS,
//     /**
//      * Google Image sitemaps, see
//      * https://support.google.com/webmasters/answer/178636
//      */
//     IMAGE,
//     /**
//      * Google Video sitemaps, see
//      * https://support.google.com/webmasters/answer/80471
//      */
//     VIDEO,
//     /**
//      * Usage of <code>&lt;xhtml:links&gt;</code> in sitemaps to include
//      * localized page versions/variants, see
//      * https://support.google.com/webmasters/answer/189077
//      */
//     LINKS,
//     /**
//      * <cite>Mobile sitemaps just contain an empty "mobile" tag to identify a
//      * URL as having mobile content</cite>, cf.
//      * http://www.google.com/schemas/sitemap-mobile/1.0
//      */
//     MOBILE
// }
// 
// Path: src/main/java/crawlercommons/sitemaps/extension/ExtensionMetadata.java
// @SuppressWarnings("serial")
// public abstract class ExtensionMetadata implements Serializable {
// 
//     public abstract boolean equals(Object other);
// 
//     public abstract Map<String, String[]> asMap();
// 
//     public boolean isValid() {
//         return true;
//     }
// 
//     /**
//      * Compare URLs by their string representation because calling
//      * {@link URL#equals(Object)} may trigger an unwanted and potentially slow
//      * DNS lookup to resolve the host part
//      */
//     protected static boolean urlEquals(URL a, URL b) {
//         return (a == b) || (a != null && b != null && a.toString().equals(b.toString()));
//     }
// 
// }


// Path: src/main/java/crawlercommons/sitemaps/SiteMapURL.java
import crawlercommons.sitemaps.extension.ExtensionMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.ZonedDateTime;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import crawlercommons.sitemaps.extension.Extension;

/**
 * Copyright 2016 Crawler-Commons
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package crawlercommons.sitemaps;




/**
 * The SitemapUrl class represents a URL found in a Sitemap.
 * 
 * @author fmccown
 */
@SuppressWarnings("serial")
public class SiteMapURL implements Serializable {
    private static final Logger LOG = LoggerFactory.getLogger(SiteMapURL.class);
    public static final double DEFAULT_PRIORITY = 0.5;

    /**
     * Allowed change frequencies
     */
    public enum ChangeFrequency {
        ALWAYS, HOURLY, DAILY, WEEKLY, MONTHLY, YEARLY, NEVER
    }

    ;

    /**
     * URL found in Sitemap (required)
     */
    private URL url;

    /**
     * When URL was last modified (optional)
     */
    private Date lastModified;

    /**
     * How often the URL changes (optional)
     */
    private ChangeFrequency changeFreq;

    /**
     * Value between [0.0 - 1.0] (optional)
     */
    private double priority = DEFAULT_PRIORITY;

    /**
     * could be false, if URL isn't found under base path as indicated here:
     * http://www.sitemaps.org/protocol.html#location *
     */
    private boolean valid;