"""Auto-generated by delta-registry-website/lib/schema-generator — do not hand-edit.
Source: Apify actor 'actor-19-maritime-sanctions-monitor' (local .actor/input_schema.json), generated 2026-09-18.
Regenerate with: node generate-all.js

NOTE: this targets AG2 Classic (import autogen), the AutoGen-lineage conversational-agent API.
"AutoGen" itself is in Microsoft-maintenance mode as of 2026; AG2 (ag2ai/ag2) is the actively
developed continuation. AG2 also has a newer, separate v1.0 protocol-driven surface (shipped
2026-09-11) not covered here because its docs could not be verified at generation time.
"""
import os
from typing import Annotated, Optional

import requests
from autogen import ConversableAgent, register_function, LLMConfig

APIFY_ACTOR_ID = 'dR68wHyuOLS2WEhmo'  # stefano_seggio/actor-19-maritime-sanctions-monitor
APIFY_RUN_SYNC_URL = f"https://api.apify.com/v2/acts/{APIFY_ACTOR_ID}/run-sync-get-dataset-items"


def run_actor_19_maritime_sanctions_monitor(
    maxItems: Annotated[Optional[int], 'Hard cap on how many vessel-type SDN records to return this run, taken in the order OFAC lists them in the source feed.'] = 250,
    onlyNew: Annotated[Optional[bool], 'When enabled, persists a content fingerprint per vessel (uid) between runs in this actor\'s own key-value store and returns only records that are new since the last run OR whose sanctions program(s) or other tracked fields changed since they were last seen - records identical to last time are skipped. Vessels no longer present in the current OFAC feed are always reported as DELISTED regardless of this setting (when the run was not itself truncated by maxItems - see the DELISTED section of README.md). Recommended for recurring monitoring; leave off for a full extraction of the current vessel-type SDN list.'] = false,
    enrichWithUnConsolidatedList: Annotated[Optional[bool], 'When enabled (default), additionally fetches the UN Security Council Consolidated Sanctions List and flags OFAC vessel records whose IMO number is also mentioned in a UN entity\'s designation text. Adds one extra live fetch and a linear scan of the UN list per run; disable for a faster OFAC-only run.'] = true,
    programFilter: Annotated[Optional[list[str]], 'Optional: only return vessels whose Program list contains at least one of these OFAC program codes (case-insensitive substring match, e.g. "IRAN", "DPRK2", "RUSSIA-EO14024"). Leave empty to return vessels from all programs.'] = None,
    vesselNameContains: Annotated[Optional[str], 'Optional case-insensitive substring filter on the vessel\'s listed name, applied before maxItems. Useful for a narrow monitoring run against one vessel of interest.'] = None,
) -> str:
    """Screens the US Treasury OFAC Specially Designated Nationals vessel list against the UN Security Council Consolidated List by IMO number, delivering normalized ship-sanctions records with cross-run change detection: new designations, program changes, and vessel delistings."""
    token = os.environ["APIFY_TOKEN"]
    payload = {
        **({"maxItems": maxItems} if maxItems is not None else {}),
        **({"onlyNew": onlyNew} if onlyNew is not None else {}),
        **({"enrichWithUnConsolidatedList": enrichWithUnConsolidatedList} if enrichWithUnConsolidatedList is not None else {}),
        **({"programFilter": programFilter} if programFilter is not None else {}),
        **({"vesselNameContains": vesselNameContains} if vesselNameContains is not None else {}),
    }
    resp = requests.post(
        APIFY_RUN_SYNC_URL,
        params={"token": token},
        json=payload,
        timeout=320,  # Apify's real run-sync-get-dataset-items cap is 300s
    )
    resp.raise_for_status()
    return resp.text


# Wire into your own agents, e.g.:
#
# with LLMConfig(api_type="openai", model="gpt-4o-mini"):
#     compliance_agent = ConversableAgent(name="compliance_agent", system_message="...")
# executor_agent = ConversableAgent(name="executor_agent", human_input_mode="NEVER")
#
# register_function(
#     run_actor_19_maritime_sanctions_monitor,
#     caller=compliance_agent,
#     executor=executor_agent,
#     description='Screens the US Treasury OFAC Specially Designated Nationals vessel list against the UN Security Council Consolidated List by IMO number, delivering normalized ship-sanctions records with cross-run change detection: new designations, program changes, and vessel delistings.',
# )
