import frappe

SKIP_FIELDS = {"name", "creation", "modified", "modified_by", "owner", "docstatus", "idx"}


@frappe.whitelist()
def export_leave_types():
    leave_types = frappe.get_all("Leave Type", fields=["name"])
    result = []

    for lt in leave_types:
        doc = frappe.get_doc("Leave Type", lt.name)
        data = doc.as_dict()

        for field in SKIP_FIELDS:
            data.pop(field, None)

        result.append(data)

    return result
