import influxframework


def execute():
	if "agriculture" in influxframework.get_installed_apps():
		return

	influxframework.delete_doc("Module Def", "Agriculture", ignore_missing=True, force=True)

	influxframework.delete_doc("Workspace", "Agriculture", ignore_missing=True, force=True)

	reports = influxframework.get_all("Report", {"module": "agriculture", "is_standard": "Yes"}, pluck="name")
	for report in reports:
		influxframework.delete_doc("Report", report, ignore_missing=True, force=True)

	dashboards = influxframework.get_all(
		"Dashboard", {"module": "agriculture", "is_standard": 1}, pluck="name"
	)
	for dashboard in dashboards:
		influxframework.delete_doc("Dashboard", dashboard, ignore_missing=True, force=True)

	doctypes = influxframework.get_all("DocType", {"module": "agriculture", "custom": 0}, pluck="name")
	for doctype in doctypes:
		influxframework.delete_doc("DocType", doctype, ignore_missing=True)

	influxframework.delete_doc("Module Def", "Agriculture", ignore_missing=True, force=True)
