"""Drop the Bank Integration Account Mapping DocType.

The child table was unused in the Bank Statement Importer flow: Bank Account
is picked explicitly in the Import dialog, so there was no need for an
IBAN→Bank Account lookup table. The kapital_bank app keeps its own
equivalent because that flow pulls transactions through an API without a
per-import Bank Account choice.

Idempotent — runs only when the DocType is still around.
"""

import frappe


def execute():
	dt = "Bank Integration Account Mapping"
	if not frappe.db.exists("DocType", dt):
		return
	# Drops both the metadata row and the underlying `tab<Name>` table.
	frappe.delete_doc("DocType", dt, ignore_permissions=True, force=True)
	frappe.db.commit()
	print(f"BI: dropped DocType '{dt}'")
