from typing import List


def create_fhir_bundle(
    resources: List[dict], bundle_type: str = "transaction"
) -> dict:
    """Creates a FHIR bundle from a list of FHIR resources

    Parameters
    ----------
    resources : List[dict]
        List of FHIR resources
    bundle_type : str, optional
        FHIR Bundle type
        https://www.hl7.org/fhir/bundle-definitions.html#Bundle.type,
        by default "transaction"

    Returns
    -------
    dict
        FHIR Bundle
    """

    return {
        "resourceType": "Bundle",
        "type": bundle_type,
        "entry": [
            {
                "resource": resource,
                "request": {"method": "POST", "url": resource["resourceType"]},
            }
            for resource in resources
        ],
    }