select 
    'shell'                 as component
  , 'Mobilizon Instances' as title
  , 'social'              as icon
  , JSON('{"title":"Statistics","link":"/stats", "icon":"chart-dots"}') as menu_item
  , JSON('{"title":"Report an instance","link":"mailto:contact@kaihuri.org?subject=report%20an%20instance","icon":"flag"}') as menu_item
  , '' as footer
;

-- add form
select 
    'form' as component
  , 'GET'  as method
  , 'add an instance' as validate
  , '/add_instance' as action
;
select 
    'domain' as name
  , 70 as maxlength
  , '[0-9.a-z]{4,70}' as pattern
  --, 'url' as type
  , 'events.example.net' as placeholder
  , true as required
  , 6 as width
;

-- instances list
select 
    'table' as component
  , true as search
  , true as small
  , true as sort
  , true as freeze_headers
  , true as striped_rows
  , 'Url' as markdown
;
select
    '[' || domain || '](https://' || domain || '/)' as Url
  , name
  , version
  , slogan
  , description
from instances
where failure >= 0  -- new, unprocessed candidates are inserted with "failure = -1"
;
