CREATE TABLE public.form_a1_village_identification (
	geom geometry(point, 4326) NULL,
	tec_name varchar(255) NULL,
	"date" timestamp NULL,
	jurisdiction varchar(255) NULL,
	jur_other varchar(255) NULL,
	vag varchar(255) NULL,
	vag_other varchar(255) NULL,
	village varchar(255) NULL,
	village_other varchar(255) NULL,
	latitude numeric(38, 10) NULL,
	longitude numeric(38, 10) NULL,
	altitude numeric(38, 10) NULL,
	accuracy numeric(38, 10) NULL,
	is_hp varchar(255) NULL,
	contact_given_name varchar(255) NULL,
	contact_family_name varchar(255) NULL,
	headperson_given_name varchar(255) NULL,
	headperson_family_name varchar(255) NULL,
	headperson_contact varchar(255) NULL,
	number_households int4 NULL,
	village_register varchar(255) NULL,
	village_recognized varchar(255) NULL,
	shrd_rsrcs_agriculture varchar(255) NULL,
	shrd_rsrcs_network varchar(255) NULL,
	shrd_rsrcs_borehole varchar(255) NULL,
	shrd_rsrcs_well varchar(255) NULL,
	shrd_rsrcs_hammermill varchar(255) NULL,
	dist_pri_school int4 NULL,
	dist_sec_school int4 NULL,
	shrd_rsrcs_church varchar(255) NULL,
	shrd_rsrcs_clinic varchar(255) NULL,
	dist_clinic int4 NULL,
	shrd_rsrcs_dam varchar(255) NULL,
	shrd_rsrcs_dip_tank varchar(255) NULL,
	shrd_rsrcs_gov_pres varchar(255) NULL,
	shrd_rsrcs_electricity varchar(255) NULL,
	shrd_rsrcs_market varchar(255) NULL,
	shrd_rsrcs_accessibility varchar(255) NULL,
	shrd_rsrcs_public_transport varchar(255) NULL,
	shrd_rsrcs_nat_res varchar(255) NULL,
	mob_network_airtel varchar(255) NULL,
	mob_network_mtn varchar(255) NULL,
	mob_network_zamtel varchar(255) NULL,
	"conflict" varchar(255) NULL,
	con_des varchar(255) NULL,
	settle_scheme text null,
	mvuvye_forest text null,
	"key" varchar(80) NOT NULL,
	ReviewState text NULL,
	CONSTRAINT form_a1_village_identification_pkey PRIMARY KEY (key)
);
CREATE INDEX form_a1_vill_id_idx ON public.form_a1_village_identification USING gist (geom);

CREATE TABLE public.form_b_village_governance (
    tec_name text NULL,
	"date" date NULL,
	jurisdiction text NULL,
    jur_other text NULL,
	vag text null,
	vag_other text null,
	village text NULL,
	village_other text NULL,
	district text NULL,
	district_other text NULL,
	ward text NULL,
	ward_other varchar NULL,
	induna_given_name text NULL,
	induna_family_name text NULL,
	induna_gender text null,
	induna_contact text null,
	induna_head_year text NULL,
	headman_given_name text NULL,
	headman_family_name text NULL,
	gender text NULL,
	contact_number text NULL,
	headperson_year_appointed date NULL,
	village_register text NULL,
	village_household_number text NULL,
	year_village_established date NULL,
	reason_establish text NULL,
	village_moved text NULL,
	village_divided text NULL,
	village_moved_when date NULL,
	village_reason_moved text NULL,
	village_reason_divided text NULL,
	community_conflict text NULL,
	neighbour_conflict text NULL,
	government_conflict text NULL,
	investor_conflict text NULL,
	village_recognized text NULL,
	community_conflict_reason text NULL,
	neighbour_conflict_reason text NULL,
	government_conflict_reason text NULL,
	investor_conflict_reason text NULL,
	community_agric_expansion text NULL,
	forest_governance text NULL,
	commitee_or_groups text NULL,
	resource_mapping_consent text NULL,
	household_land_certification_consent text NULL,
	land_use_planning_consent text NULL,
	data_use_consent text NULL,
	national_sys text NULL,
	community_representative_consent text NULL,
	signature text NULL,
	resource_mapping_no_consent_reason text NULL,
	household_land_certification_no_consent_reason text NULL,
	land_use_planning_no_consent_reason text NULL,
	data_use_no_consent_reason text NULL,
	community_representative_no_consent_reason text NULL,
	map_group_narrative text NULL,
    map_state_land text NULL,
    map_state_land_desc text NULL,
    map_private_land text NULL,
    map_private_land_desk text NULL,
    participate_men text NULL,
    participate_women text NULL,
    participate_youth_men text NULL,
    participate_youth_women text NULL,
    headperson_supportive text NULL,
    gender_supportive text NULL,
    inclusion_support text NULL,
    youth_supportive text NULL,
	"comment" text NULL,
	meeting_image text NULL,
	"key" varchar(80) NOT NULL,
	ReviewState text NULL,
	CONSTRAINT form_b_village_governance_pkey PRIMARY KEY (key)
);

CREATE TABLE public.form_b_governance_development (
	development_actors text NULL,
	development_actors_other text NULL,
	village_actor_issues text NULL,
	relation_dev int8 null,
	village text NULL,
	parent_key varchar(80) NULL,
	"key" varchar(80) NOT NULL,
	CONSTRAINT form_b_governance_development_pkey PRIMARY KEY (key),
    CONSTRAINT form_b_governance_development_fk FOREIGN KEY (parent_key) REFERENCES public.form_b_village_governance("key")
);

CREATE TABLE public.form_b_governance_group_maps (
	photo text NULL,
	map_notes text NULL,
	map_author text NULL,
	"key" varchar(80) NOT NULL,
	parent_key varchar(80) NULL,
	CONSTRAINT form_b_governance_group_maps_pkey PRIMARY KEY (key),
	CONSTRAINT form_b_governance_group_maps_fk FOREIGN KEY (parent_key) REFERENCES public.form_b_village_governance("key")
);

CREATE TABLE public.form_b_governance_village_register (
	register_notes text NULL,
	village text NULL,
	photo text NULL,
	"key" varchar(80) NOT NULL,
	parent_key varchar(80) NULL,
	CONSTRAINT form_b_governance_village_register_pkey PRIMARY KEY (key),
	CONSTRAINT form_b_governance_village_register_fk FOREIGN KEY (parent_key) REFERENCES public.form_b_village_governance("key")
);

CREATE TABLE public.form_d1_point_of_interest (
	geom geometry NULL,
	tec_name text NULL,
	jurisdiction text NULL,
	jur_other text NULL,
	"date" date NULL,
	latitude numeric(38, 10) NULL,
	longitude numeric(38, 10) NULL,
	altitude numeric(38, 10) NULL,
	accuracy numeric(38, 10) NULL,
	"descriptor" text NULL,
	descriptor_other text NULL,
	resource_name text NULL,
	tenure text NULL,
	resource_manager text NULL,
	management_problems text NULL,
	resource_notes text NULL,
	image text NULL,
	"key" text NOT NULL,
	ReviewState text NULL,
	CONSTRAINT form_d1_point_of_interest_pkey PRIMARY KEY (key)
);
CREATE INDEX sidx_form_d1_point_of_interest_geom ON public.form_d1_point_of_interest USING gist (geom);

CREATE TABLE public.form_d2_shared_resources (
	geom geometry(multipolygon, 4326),
	organization text NULL,
	tec_name text NULL,
	jurisdiction text NULL,
	jur_other text NULL,
	"date" timestamp NULL,
	ref_map_id text NULL,
	id_means text NULL,
	area_descriptor text NULL,
	other_area text NULL,
	res_name text NULL,
	auto_shp text NULL,
	res_code text NULL,
	tenure_type text NULL,
	management_institution text NULL,
	management_problems text NULL,
	management_notes text NULL,
	uses text NULL,
	principle_use text NULL,
	uses_other text NULL,
	use_rules text NULL,
	narrative text NULL,
	"key" varchar(80) NOT NULL,
	ReviewState text null,
	CONSTRAINT form_d2_shared_resources_pkey PRIMARY KEY (key)
);
CREATE INDEX sidx_form_d2_shared_resources_geom ON public.form_d2_shared_resources USING gist (geom);

CREATE TABLE public.form_i1_meeting (
	geom geometry(point, 4326) NULL,
	organization text NULL,
	organization_other text NULL,
	tec_name text NULL,
    tec_given_name text NULL,
    tec_family_name text NULL,
	"date" timestamp NULL,
	jurisdiction text NULL,
    jur_other text NULL,
	village text NULL,
    village_other text NULL,
    latitude numeric(38, 10) NULL,
    longitude numeric(38, 10) NULL,
	altitude numeric(38, 10) NULL,
	accuracy numeric(38, 10) NULL,
	meeting_category text NULL,
	meeting_type text NULL,
	meeting_type_other text NULL,
    meeting_title text NULL,
    meeting_days text NULL,
	has_conflict text NULL,
	includes_gender text NULL,
    includes_bio_wildlife  text NULL,
    includes_forest_mgmt  text NULL,
    includes_micro_ent text NULL,
    includes_land_based  text NULL,
	conflict_details text NULL,
    conflict_groups text NULL,
	gender_details text NULL,
	female_attending int4 NULL,
	male_attending int4 NULL,
	female_youth_attending int4 NULL,
	male_youth_attending int4 NULL,
    training_curriculum text NULL,
    training_goals text NULL,
    training_objectives text NULL,
    training_objectives_no text NULL,
	photo_meeting text NULL,
	observation  text NULL,
	"key" varchar(80) NOT NULL,
	ReviewState text null,
	CONSTRAINT form_i1_meeting_pk PRIMARY KEY (key)
);
CREATE INDEX sidx_form_i1_meeting_geom ON public.form_i1_meeting USING gist (geom);