/*
 * FeedType.vala
 * 
 * Enum for RSS/Atom feed types
 */

public enum RSSuper.FeedType {
    UNKNOWN,
    RSS_1_0,
    RSS_2_0,
    ATOM;

    public static FeedType from_string(string type) {
        switch (type.down()) {
            case "rss":
            case "application/rss+xml":
                return RSS_2_0;
            case "atom":
            case "application/atom+xml":
                return ATOM;
            case "rdf":
            case "application/rdf+xml":
                return RSS_1_0;
            default:
                return UNKNOWN;
        }
    }

    public string to_string() {
        switch (this) {
            case RSS_1_0:
                return "RSS 1.0";
            case RSS_2_0:
                return "RSS 2.0";
            case ATOM:
                return "Atom";
            default:
                return "Unknown";
        }
    }
}
