import asyncio
from aws_sdk_bedrock_runtime.client import BedrockRuntimeClient
from aws_sdk_bedrock_runtime.models import ListAsyncInvokesInput
from aws_sdk_bedrock_runtime.config import Config
from smithy_aws_core.identity.environment import EnvironmentCredentialsResolver
from smithy_core.retries import RetryStrategyOptions, SimpleRetryStrategy


async def main():
    # Default retry_strategy
    default_config = Config(
        region="us-west-2",
        aws_credentials_identity_resolver=EnvironmentCredentialsResolver(),
    )
    default_client = BedrockRuntimeClient(config=default_config)
    default_result = await default_client.list_async_invokes(ListAsyncInvokesInput())
    print(f"With nothing: {default_result}")

    # With RetryStrategyOptions
    options_config = Config(
        region="us-west-2",
        aws_credentials_identity_resolver=EnvironmentCredentialsResolver(),
        retry_strategy=RetryStrategyOptions(max_attempts=2),
    )
    options_client = BedrockRuntimeClient(config=options_config)
    options_result = await options_client.list_async_invokes(ListAsyncInvokesInput())
    print(f"With RetryStrategyOptions: {options_result}")

    # With StandardRetryStrategy
    full_strategy_config = Config(
        region="us-west-2",
        aws_credentials_identity_resolver=EnvironmentCredentialsResolver(),
        retry_strategy=SimpleRetryStrategy(),
    )
    full_strategy_client = BedrockRuntimeClient(config=full_strategy_config)
    full_strategy_result = await full_strategy_client.list_async_invokes(
        ListAsyncInvokesInput()
    )
    print(f"With StandardRetryStrategy: {full_strategy_result}")

    # With invalid strategy
    broken_config = Config(
        region="us-west-2",
        aws_credentials_identity_resolver=EnvironmentCredentialsResolver(),
        retry_strategy="foo",
    )
    broken_client = BedrockRuntimeClient(config=broken_config)
    try:
        broken_result = await broken_client.list_async_invokes(ListAsyncInvokesInput())
    except TypeError as e:
        print(f"With string (invalid): {e}")


if __name__ == "__main__":
    asyncio.run(main())

# Output:
# With nothing: ListAsyncInvokesOutput(next_token=None, async_invoke_summaries=[])
# With RetryStrategyOptions: ListAsyncInvokesOutput(next_token=None, async_invoke_summaries=[])
# With StandardRetryStrategy: ListAsyncInvokesOutput(next_token=None, async_invoke_summaries=[])
# With string (invalid): retry_strategy must be RetryStrategy, RetryStrategyOptions, or None, got str
