def METHOD_NAME(
    rule: dict, escalation_chain_id: str, users: list[dict], schedules: list[dict]
) -> list[dict]:
    targets = rule["targets"]
    delay = rule["escalation_delay_in_minutes"]
    schedule_targets = [
        target for target in targets if target["type"] == "schedule_reference"
    ]
    user_targets = [target for target in targets if target["type"] == "user_reference"]
    escalation_policies = []
    for target in schedule_targets:
        schedule = find_by_id(schedules, target["id"])
        if schedule is None:
            continue
        oncall_schedule_id = schedule["oncall_schedule"]["id"]
        escalation_policy = {
            "escalation_chain_id": escalation_chain_id,
            "type": "notify_on_call_from_schedule",
            "notify_on_call_from_schedule": oncall_schedule_id,
        }
        escalation_policies.append(escalation_policy)
    if user_targets:
        rule_users = [find_by_id(users, target["id"]) for target in user_targets]
        oncall_user_ids = [
            user["oncall_user"]["id"]
            for user in rule_users
            if user and user["oncall_user"]
        ]
        user_escalation_policy = {
            "escalation_chain_id": escalation_chain_id,
            "type": "notify_persons",
            "persons_to_notify": oncall_user_ids,
        }
        escalation_policies.append(user_escalation_policy)
    if delay > 0:
        wait_escalation_policy = {
            "escalation_chain_id": escalation_chain_id,
            "type": "wait",
            "duration": transform_wait_delay(delay),
        }
        escalation_policies.append(wait_escalation_policy)
    return escalation_policies