{
    "$schema": "http://json-schema.org/draft-07/schema",
    "description": "Freifunk Community API 0.5.2",
    "type": "object",
    "definitions": {

        "city": {
            "type": "string",
            "title": "City",
            "description": "Name of the city"
        },

        "country": {
            "type": "string",
            "title": "Country",
            "description": "Your country, list has been taken from http://countrylist.net/de/",
            "enum": ["", "AF","AX","AL","DZ","AS","AD","AO","AI","AQ","AG","AR","AM","AW","AC","AU","AT","AZ","BS","BH","BD","BB","BY","BE","BZ","BJ","BM","BT","BO","BA","BW","BV","BR","IO","BN","BG","BF","BI","KH","CM","CA","IC","CV","KY","CF","TD","CL","CN","CX","CC","CO","KM","CG","CD","CK","CR","CI","HR","CU","CY","CZ","DK","DG","DJ","DM","DO","EC","EG","SV","GQ","ER","EE","ET","EU","FK","FO","FJ","FI","FR","GF","PF","TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GG","GN","GW","GY","HT","HM","VA","HN","HK","HU","IS","IN","ID","IR","IQ","IE","IM","IL","IT","JM","JP","JE","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS","LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH","MQ","MR","MU","YT","MX","FM","MD","MC","MN","ME","MS","MA","MZ","MM","NA","NR","NP","NL","AN","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM","PK","PW","PS","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO","RU","RW","SH","KN","LC","PM","VC","WS","SM","ST","SA","NT","SN","CS","SC","SL","SG","SK","SI","SB","SO","ZA","GS","SU","ES","LK","SD","SR","SJ","SZ","SE","CH","SY","TW","TJ","TZ","TH","TL","TG","TK","TO","TT","TA","TN","TR","TM","TC","TV","UG","UA","AE","GB","US","UY","UZ","VU","VE","VN","VG","VI","WF","EH","YE","ZM","ZW"]
        },

        "address": {
            "type":"object",
            "description": "The address of the place you meet",
            "properties": {
                "name": {
                    "type": "string",
                    "title": "Name of your place",
                    "description": "The name of the place you meet"
                },
                "street": {
                    "type": "string",
                    "title": "Street",
                    "description": "The street address of your meeting place"
                },
                "zipcode": {
                    "type": "string",
                    "title": "ZIP",
                    "description": "The zip code of your meeting place"
                }
            },
            "additionalProperties": false
        },

        "geoCode" :{
            "type": "object",
            "properties":{
                "lat": {
                    "type": "number",
                    "title": "Latitude",
                    "description": "Lattitude of your city in decimal degrees"
                },
                "lon": {
                    "type": "number",
                    "title": "Longitude",
                    "description": "Longitude of your city in decimal degrees"
                }
            },
            "required": ["lat", "lon"],
            "additionalProperties": false
        },

        "email": {
            "type": "string",
            "title": "Email",
            "format": "email",
            "pattern": "^[A-Za-z0-9äöüÄÖUß_\\-\\.]+@[A-Za-z0-9äöüÄÖUß_\\-\\.]+\\.[A-Za-z]{2,}$"
        },

        "url": {
            "type": "string",
            "pattern": "^(http|https)://[A-Za-z0-9ÄÖÜäöüß\\-_\\./]+"
        },

        "phone": {
            "type": "string",
            "title": "Phone"
        }
    },

    "properties": {

        "api": {
            "type": "string",
            "title": "API",
            "description": "The Freifunk Community API version you use",
            "enum": ["0.1", "0.2.0", "0.2.1", "0.3.0", "0.3.1", "0.3.2", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.4.10", "0.4.11", "0.4.12", "0.4.13", "0.4.14", "0.4.15", "0.4.16", "0.5.0", "0.5.1", "0.5.2"],
            "default": "0.5.2"
        },

        "name": {
            "type": "string",
            "title": "Name",
            "description": "The name of your community"
        },

        "metacommunity": {
            "type": "string",
            "title": "Metacommunity",
            "description": "The name of your metacommunity, if your local community belongs to a bigger one"
        },

        "location": {
            "title": "Primary Location",
            "type": "object",
            "description": "Position data such as a postal address or geographic coordinates",
            "properties": {
                "city": { "$ref": "#/definitions/city" },
                "country": { "$ref": "#/definitions/country" },
                "address": { "$ref": "#/definitions/address" },
                "geoCode": { "$ref": "#/definitions/geoCode" },
                "additionalLocations": {
                    "type": "array",
                    "title": "Additional Locations",
                    "description": "Add some more locations where your community is active.",
                    "items": {
                        "title": "Location",
                        "type": "object",
                        "properties": {
                            "city": { "$ref": "#/definitions/city" },
                            "country": { "$ref": "#/definitions/country" },
                            "address": { "$ref": "#/definitions/address" },
                            "geoCode": { "$ref": "#/definitions/geoCode" }
                        },
                        "required": ["city", "geoCode"],
                        "additionalProperties": false
                    }
                }
            },
            "required": ["city", "geoCode"],
            "additionalProperties": false
        },

        "contact": {
            "type": "object",
            "minProperties": 1,
            "properties": {
                "email": { 
                    "$ref": "#/definitions/email",
                    "title": "Email",
                    "description": "Email address to which other people can contact your community (user@domain.com)"
                },
                "facebook": {
                    "type": "string",
                    "title": "facebook",
                    "description": "URL to your community's facebook account (https://facebook.com/...)",
                    "pattern": "^(http|https)://([a-z\\-]*\\.|)facebook\\.com/[A-Za-z0-9ÄÖÜäöüß\\-_\\.]+"
                },
                "identica": {
                    "type": "string",
                    "title": "identica",
                    "description": "URL to your community's identica account (https://identi.ca/...)",
                    "pattern": "^(http|https)://([a-z\\-]*\\.|)identi\\.ca/[A-Za-z0-9ÄÖÜäöüß\\-_\\.]+"
                },
                "irc": {
                    "type":"string",
                    "title": "IRC",
                    "description": "Your community's ICR channel; starts with irc://",
                    "pattern": "^(irc|ircs)://.*"
                },
                "jabber": {
                    "type": "string",
                    "title": "Jabber",
                    "description": "A jabber account someone reads (account@jabberserver.tld)",
                    "pattern": "^[A-Za-z0-9äöüÄÖUß_\\-\\.]+@[A-Za-z0-9äöüÄÖUß_\\-\\.]+\\.[A-Za-z]{2,}(\\?join){0,1}$"
                },
                "ml": {
                    "type": "string",
                    "title": "Mailinglist",
                    "description": "The email address (user@domain.com) of your mailing list or a link to the mailinglist info page (http{s}://...)",
                    "pattern": "^([A-Za-z0-9äöüÄÖUß_\\-\\.]+@[A-Za-z0-9äöüÄÖUß_\\-\\.]+\\.[A-Za-z]{2,}|(http|https)://[A-Za-z0-9ÄÖÜäöüß\\-_\\./]+)$"
                },
                "googleplus": {
                    "type": "string",
                    "title": "Google+",
                    "description": "URL to your community's g+ account (https://plus.google.com/...)",
                    "pattern": "^(http|https)://plus\\.google\\.com/[A-Za-z0-9ÄÖÜäöüß\\+\\-\\./_]+"
                },
                "matrix": {
                    "type": "string",
                    "title": "Matrix",
                    "description": "URL to your community's matrix channel (https://matrix.to/#/!...)",
                    "pattern": "^https://matrix\\.to/#/"
                },
                "mastodon": {
                    "title": "Mastodon",
                    "$ref": "#/definitions/url",
                    "description": "URL to your community's mastodon profile (https://...)"
                },
                "twitter": {
                    "type": "string",
                    "title": "Twitter",
                    "description": "Your community's Twitter name (starts with @)",
                    "pattern": "^@[A-Za-z0-9_\\-]{1,15}"
                },
                "webform": {
                    "$ref": "#/definitions/url",
                    "title": "Webform",
                    "description": "URL to your community's contact form (http{s}://...)"
                },
                "phone": {
                    "$ref": "#/definitions/phone",
                    "title": "Phone",
                    "description": "If your community has a phone number (e.g. +49 1234 567890 based on the E.123 notation)"
                }
            },
            "additionalProperties": false
        },

        "url": {
            "title": "HomePage",
            "$ref": "#/definitions/url",
            "description": "The main website (http{s}://...)"
        },

        "timeline": {
            "type": "array",
            "description": "These are lifetime events something like date of birth (and rebirth :-) of your community or other important milestones",
            "items": {
                "type": "object",
                "properties": {
                    "description": {
                        "type": "string",
                        "title": "Description",
                        "description": "Description of your lifetime event"
                    },
                    "timestamp": {
                        "type": "string",
                        "title": "Timestamp",
                        "format": "date",
                        "description": "ISO 8601 timestamp of the event's date (format yyyy-mm-dd)",
                        "pattern": "^([0-9]{4})(?:-?W([0-9]+)(?:-?([0-9]+)D?)?|(?:-([0-9]+))?-([0-9]+))(?:[T ]([0-9]+):([0-9]+)(?::([0-9]+)(?:\\.([0-9]+))?)?)?(?:Z(-?[0-9]*))?"
                    },
                    "url": {
                        "$ref": "#/definitions/url",
                        "title": "URL",
                        "description": "URL to details of this timeline-element"
                    }
                },
                "additionalProperties": false
            }
        },

        "feeds": {
            "type": "array",
            "title": "Feeds",
            "description": "Feeds you provide your community",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "title": "Feed name",
                        "description": "Name of the feed"
                    },
                    "category": {
                        "type": "string",
                        "title": "Feed category",
                        "description": "Category of the feed like blog entries, calendars, forum messages, wiki articles, ...",
                        "enum": ["blog", "forum", "ics", "podcast", "wiki", "others", ""],
                        "default": ""
                    },
                    "type": {
                        "type": "string",
                        "title": "Feed Type",
                        "description": "Type of the feed like RSS, Atom, XML"
                    },
                    "url": {
                        "$ref": "#/definitions/url",
                        "title": "URL",
                        "description": "URL of the feed"
                    }
                },
                "additionalProperties": false
            }
        },

        "state": {
            "type": "object",
            "title": "States",
            "description": "A collection of status-related data. Actual open/closed status, icons, last change timestamp etc.",
            "properties": {
                "nodes": {
                    "type": "integer",
                    "minimum": 0,
                    "title": "Active Nodes",
                    "description": "Number of active nodes. This field is predestined to be updated regularly, please see sample solutions for <a href=\"https://github.com/Freifunk-Mainz/changeffapi\" target=\"_blank\">Gluon</a> or <a href=\"https://github.com/freifunk/common.api.freifunk.net/blob/master/contrib/ffapi-update-nodes.py\" target=\"_blank\">OLSR</a>"
                },
                "lastchange": {
                    "type":"string",
                    "title": "Last Change",
                    "format": "date-time",
                    "description": "At what ISO 8601 timestamp has your community status lastly changed?",
                    "default": 0
                },
                "message": {
                    "type": "string",
                    "title": "Message",
                    "description": "A free-form string something like 'open for public', 'members only' or whatever you want it to be)"
                },
                "description": {
                    "type":"string",
                    "title": "Description",
                    "description": "Describe your community in a few lines"
                },
                "focus": {
                    "type": "array",
                    "title": "Focus",
                    "description": "What's the focus of your local community?",
                    "items": {
                        "type": "string",
                        "title": "option",
                        "enum": ["infrastructure/backbone", "Public Free Wifi", "Social Community Building", "Local services and content", "Free internet access" ]
                    }
                }
            },
            "required": [ "lastchange" ],
            "additionalProperties": false
        },

        "nodeMaps": {
            "type": "array",
            "title": "Nodes",
            "description": "Maps of nodes or topology your community provides",
            "items": {
                "type": "object",
                "title": "node",
                "properties": {
                    "url": {
                        "$ref": "#/definitions/url",
                        "title": "URL of the map",
                        "description": "The URL where the map is located"
                    },
                    "interval": {
                        "type": "string",
                        "title": "interval",
                        "description": "How often the map will be refreshed"
                    },
                    "technicalType": {
                        "type": "string",
                        "title": "map techincal type",
                        "description": "The kind of map is used",
                        "enum": [ "", "ffmap", "ffsomething", "olsr-dot", "openwifimap", "netmon", "libremap", "nodewatcher", "kml", "nodelist", "meshviewer", "hopglass" ],
                        "default": ""
                    },
                    "mapType": {
                        "type": "string",
                        "title": "Maptype",
                        "description": "",
                        "enum": [ "", "geographical", "structural", "list/status" ],
                        "default": ""
                    }
                },
                "additionalProperties": false
            }
        },

        "services": {
            "type": "array",
            "title": "Services",
            "description": "Services Provided by your community",
            "items": {
                "type": "object",
                "properties": {
                    "serviceName": {
                        "type": "string",
                        "title": "Service Name",
                        "description": "Name of your service (e.g. jabber...)"
                    },
                    "serviceDescription": {
                        "type": "string",
                        "title": "Service Description",
                        "description": "Describe your service"
                    },
                    "externalUri": {
                        "type": "string",
                        "title": "External URI",
                        "description": "URI to use your service from the internet"
                    },
                    "internalUri": {
                        "type": "string",
                        "title": "Internal URI",
                        "description": "URI to use your service from Freifunk or icvpn-networks"
                    }
                },
                "additionalProperties": false
            }
        },

        "support": {
            "type": "object",
            "title": "Support for your community",
            "properties": {
                "club": {
                    "type": "object",
                    "title": "Supporting Club",
                    "properties": {
                        "name": {
                            "type": "string",
                            "title": "Club Name",
                            "description": "Name of the Club"
                        },
                        "street": {
                            "type": "string",
                            "title": "Street",
                            "description": "Address - Street"
                        },
                        "zip": {
                            "type": "string",
                            "title": "ZIP",
                            "description": "Address - ZIP"
                        },
                        "city": { "$ref": "#/definitions/city" },
                        "url": {
                            "$ref": "#/definitions/url",
                            "title": "HomePage",
                            "description": "The club's website (http{s}://...)"
                        },
                        "email": {
                            "$ref": "#/definitions/email",
                            "description": "Email address to contact the club (user@domain.com)"
                        },
                        "board": {
                            "type": "array",
                            "title": "Board Members",
                            "description": "Who are the board members of the club?",
                            "items": {
                                "type": "string",
                                "title": "Name"
                            }
                        }
                    },
                    "additionalProperties": false
                },
                "donations": {
                    "type": "object",
                    "title": "Donations",
                    "properties": {
                        "bankaccount": {
                            "type": "object",
                            "title": "Bank Account",
                            "properties": {
                                "IBAN": {
                                    "type": "string",
                                    "title": "IBAN"
                                },
                                "BIC": {
                                    "type": "string",
                                    "title": "BIC"
                                },
                                "usage": {
                                    "type": "string",
                                    "title": "Usage of the donations",
                                    "description": "Please use this string as transfer-purpose to define a special usage of your donation."
                                }
                            },
                            "additionalProperties": false
                        },
                        "campaigns": {
                            "type": "array",
                            "title": "Campaigns",
                            "items": {
                                "type": "object",
                                "title": "campaign",
                                "properties": {
                                    "provider": {
                                        "type": "string",
                                        "title": "Campaign Providers",
                                        "description": "Where do you host your donations?",
                                        "enum": [ "", "betterplace", "boost" ],
                                        "default": ""
                                    },
                                    "projectid": {
                                        "type": "string",
                                        "title": "Project ID",
                                        "description": "ID of your project, Betterplace-IDs are multiple digits and can be found within the URL"
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    },
                    "additionalProperties": false
                }
            },
            "additionalProperties": false
        },

        "socialprojects": {
            "type": "object",
            "title": "",
            "properties": {
                "number": {
                    "type": "integer",
                    "mininum": 0,
                    "title": "Number of Projects",
                    "description": "Number of projects supported by your Community"
                },
                "website": {
                    "$ref": "#/definitions/url",
                    "title": "URL of your page",
                    "description": "A link to a web site where people can find an overview over your projects"
                },
                "contact": {
                    "$ref": "#/definitions/email",
                    "title": "Contact Email",
                    "description": "Please provide an email address to contact you on refugees and social projects"
                }
            },
            "additionalProperties": false
        },

        "privacy": {
            "type": "object",
            "title": "Privacy Policy",
            "properties": {
                "policyurl": {
                    "$ref": "#/definitions/url",
                    "title": "Privacy Policy URL",
                    "description": "URL to your privacy policy description"
                }
            },
            "additionalProperties": false
        },

        "techDetails": {
            "type": "object",
            "description": "Technical details of your community's Freifunk implementation",
            "properties": {
                "firmware": {
                    "type": "object",
                    "properties": {
                        "url": {
                            "$ref": "#/definitions/url",
                            "title": "Firmware download",
                            "description": "Link to your firmware images"
                        },
                        "docs": {
                            "$ref" : "#/definitions/url",
                            "title": "Firmware Document",
                            "description": "Link to your firmware docs"
                        },
                        "vpnaccess": {
                            "type": "string",
                            "title": "VPN Access",
                            "description": "How to access your VPN services",
                            "enum": [ "", "automatic", "fwimage", "mail", "webform", "else" ],
                            "default": ""
                        },
                        "registrationurl": {
                            "$ref": "#/definitions/url",
                            "title": "VPN Registration URL",
                            "description": "link to your website to request a new VPN key"
                        },
                        "orgrestrictions": {
                            "type": "string",
                            "title": "Organizational Restrictions",
                            "description": "Are there any organizational restrictions when using/installing your firmware?"
                        },
                        "techrestrictions": {
                            "type": "string",
                            "title": "Technical Restriction",
                            "description": "Are there any technical restrictions like hardware?"
                        },
                        "name": {
                            "type":"string",
                            "title": "Firmware Name",
                            "description": "Name of your firmware"
                        }
                    },
                    "additionalProperties": false
                },
                "dns": {
                    "type": "array",
                    "title": "DNS Servers",
                    "description": "DNS servers for domains used by your community",
                    "items": {
                        "type": "object",
                        "title": "dns",
                        "properties": {
                            "domainname": {
                                "type": "string",
                                "title": "Domain Name",
                                "description": "The domain name (e.g. ffhh, ffol)",
                                "pattern": "^[A-Za-z0-9äöüÄÖÜß\\.\\-\\_]{2,}$"
                            },
                            "nameserver": {
                                "type": "array",
                                "title": "Nameserver",
                                "description": "Nameservers servings zones of your domain",
                                "items": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z0-9äöüÄÖÜß_\\-\\.:]*$"
                                }
                            }
                        },
                        "additionalProperties": false
                    }
                },
                "networks": {
                    "type": "object",
                    "description": "Networks used by your community",
                    "properties": {
                        "ipv6": {
                            "type": "array",
                            "title": "IPv6 networks",
                            "description": "IPv6 networks used by your community",
                            "items": {
                                "type": "object",
                                "title": "ipv6 network object",
                                "properties": {
                                    "network": {
                                        "type": "string",
                                        "description": "IPv6 network network (e.g.2620:0:2d0:200::7/32) in CIDR notation",
                                        "pattern": "^\\s*((([0-9A-Fa-f]{1,4}:){7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-9]?\\d)){3}))|:)))(%.+)?\\s*(\\/(\\d|\\d\\d|1[0-1]\\d|12[0-8]))$"
                                    }
                                },
                                "additionalProperties": false
                            }
                        },
                        "ipv4": {
                            "type": "array",
                            "description": "IPv4 networks used by your community",
                            "items": {
                                "type": "object",
                                "title": "ipv4 network object",
                                "properties": {
                                    "network": {
                                        "type": "string",
                                        "description": "IPv4 network name (e.g. 10.w.x.y/z) in CIDR notation",
                                        "pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\/(\\d|[1-2]\\d|3[0-2]))$"
                                    }
                                },
                                "additionalProperties": false
                            }
                        }
                    },
                    "additionalProperties": false
                },
                "routing": {
                    "type": "array",
                    "title": "Routing protocols",
                    "description": "Routing protocols used within your community",
                    "items": {
                        "type": "string",
                        "title": "option",
                        "enum": [ "802.11s", "Babel", "batman-adv", "bmx6", "bmxd", "cjdns", "OLSR", "OLSRv2" ]
                    }
                },
                "legals": {
                    "type": "array",
                    "title": "Legal Issues",
                    "description": "What do you use to handle legal issues, e.g. the German Störerhaftung or restrictions in your country?",
                    "items": {
                        "type": "string",
                        "title": "option",
                        "enum": [ "nothing", "vpnnational", "vpninternational", "zappscript", "p2pblock", "splashpage", "termsconditions", "anonymizer", "institutions" ]
                    }
                },
                "updatemode": {
                    "type": "array",
                    "title": "Updatemode",
                    "description": "How do you deploy firmware updates?",
                    "items": {
                        "type": "string",
                        "title": "option",
                        "enum": [ "none", "manual", "autoupdate" ]
                    }
                }
            },
            "additionalProperties": false
        }
    },
    "required": ["name", "location", "contact", "url", "state", "techDetails" ],
    "additionalProperties": false
}