local flex = require('flex-base')

flex.set_main_tags{
    building = 'fallback',
    healthcare = 'fallback',
    historic = 'fallback',
    military = 'named',
    natural = 'named',
    highway = 'named',
    railway = {'none',
               rail = 'named',
               platform = 'named',
               stop = 'named',
               tram = 'named',
               station = 'named',
               subway = 'named',
               narrow_gauge = 'named',
               tram_stop = 'named',
               light_rail = 'named',
               halt = 'named',
               miniature = 'named',
               facility = 'named',
               yard = 'named',
               monorail = 'named',
               funicular = 'named'},
    man_made = {'none',
                pier = 'named',
                tower = 'named',
                bridge = 'named',
                works = 'named',
                water_tower = 'named',
                dyke = 'named',
                lighthouse = 'named',
                watermill = 'named',
                tunnel = 'named'},
    aerialway = 'named',
    boundary = {'named',
                postal_code = 'always'},
    aeroway = {'none',
               hangar = 'named',
               aerodrome = 'named',
               terminal = 'named',
               airstrip = 'named',
               tower = 'named'},
    amenity = 'named',
    club = 'named',
    craft = 'named',
    junction = 'fallback',
    landuse = 'fallback',
    leisure = {'named',
               nature_reserve = 'fallback'},
    office = 'named',
    mountain_pass = 'fallback',
    shop = 'named',
    tourism = 'named',
    bridge = 'named_with_key',
    tunnel = 'named_with_key',
    waterway = 'named',
    place = 'always'
}

flex.set_prefilters{delete_keys = {'note', 'note:*', 'source', '*source', 'attribution',
                                   'comment', 'fixme', 'FIXME', 'created_by', 'NHD:*',
                                   'nhd:*', 'gnis:*', 'geobase:*', 'KSJ2:*', 'yh:*',
                                   'osak:*', 'naptan:*', 'CLC:*', 'import', 'it:fvg:*',
                                   'type', 'lacounty:*', 'ref:ruian:*', 'building:ruian:type',
                                   'ref:linz:*', 'is_in:postcode',
                                   '*:prefix', '*:suffix', 'name:prefix:*', 'name:suffix:*',
                                   'name:etymology', 'name:signed', 'name:botanical',
                                   '*:wikidata', '*:wikipedia', 'brand:wikipedia:*',
                                   'addr:street:name', 'addr:street:type'},
                    delete_tags = {historic = {'yes', 'no'},
                                   military = {'yes', 'no'},
                                   natural = {'yes', 'no', 'coastline'},
                                   highway = {'no', ' crossing' , ' street_lamp',
                                              'turning_circle', 'mini_roundabout',
                                              'noexit', 'crossing', 'give_way', 'stop',
                                              'milestone', ' speed_camera',
                                              'emergency_access_point', 'corridor',
                                              'abandoned', 'razed'},
                                   aerialway = {'pylon', 'no'},
                                   amenity = {'no', 'parking_space', 'parking_entrance'},
                                   club = {'no'},
                                   craft = {'no'},
                                   leisure = {'no'},
                                   office = {'no'},
                                   mountain_pass = {'no'},
                                   shop = {'no'},
                                   tourism = {'yes', 'no'},
                                   bridge = {'no'},
                                   tunnel = {'no'},
                                   waterway = {'riverbank'},
                                   building = {'no'},
                                   boundary = {'place', 'land_area', 'marker', 'historic'}},
                    extra_keys = {'wikidata', 'wikipedia', 'wikipedia:*'}
                   }

flex.set_name_tags{main = {'name', 'name:*',
                          'int_name', 'nat_name', 'reg_name',
                          'loc_name', 'old_name', 'alt_name'},
                   extra = {'ref', 'ISO3166-2'},
                   house = {'addr:housename'}
                  }

flex.set_address_tags{main = {'addr:housenumber',
                              'addr:conscriptionnumber',
                              'addr:streetnumber'},
                      extra = {'addr:*', 'is_in:*', 'tiger:county'},
                      postcode = {'postal_code', 'postcode', 'addr:postcode',
                                  'tiger:zip_left', 'tiger:zip_right'},
                      country = {'country_code', 'ISO3166-1',
                                 'addr:country_code', 'is_in:country_code',
                                 'addr:country', 'is_in:country'},
                      interpolation = {'addr:interpolation'}
                     }


flex.set_unused_handling{extra_keys = {'place'}}

return flex
