"""VenomQA Action Tools Library.

This module provides reusable action functions for QA testing including:
- HTTP actions (REST, GraphQL, WebSocket)
- Authentication helpers (OAuth2, JWT, API Key, Basic)
- Database actions (query, insert, update, delete)
- Wait/polling actions
- Assertion helpers
- Email testing actions
- Mock server integration
"""

from venomqa.tools.assertions import (
    assert_all,
    assert_contains,
    assert_cookie_exists,
    assert_cookie_value,
    assert_custom,
    assert_ends_with,
    assert_header,
    assert_header_contains,
    assert_header_exists,
    assert_header_generic,
    assert_is_empty,
    assert_is_not_empty,
    assert_json_contains,
    assert_json_has_key,
    assert_json_keys,
    assert_json_list_length,
    assert_json_path,
    assert_json_path_generic,
    assert_json_schema,
    assert_json_type,
    assert_json_value_between,
    assert_json_value_equals,
    assert_json_value_greater_than,
    assert_json_value_less_than,
    assert_length,
    assert_matches_regex,
    assert_not_contains,
    assert_redirect,
    assert_redirect_to,
    assert_response_time,
    assert_response_time_range,
    assert_schema,
    assert_starts_with,
    assert_status,
    assert_status_bad_request,
    assert_status_client_error,
    assert_status_code,
    assert_status_created,
    assert_status_forbidden,
    assert_status_no_content,
    assert_status_not_found,
    assert_status_ok,
    assert_status_server_error,
    assert_status_unauthorized,
)
from venomqa.tools.auth import (
    api_key_auth,
    basic_auth,
    bearer_token_auth,
    clear_auth,
    create_auth_header,
    decode_jwt_payload,
    ensure_authenticated,
    get_auth_headers,
    get_time_until_expiration,
    get_token_claims,
    get_token_expiration,
    get_user_id,
    has_scope,
    is_authenticated,
    is_token_expired,
    jwt_login,
    oauth2_client_credentials,
    oauth2_login,
    oauth2_refresh_token,
    set_auth_context,
    switch_user,
)
from venomqa.tools.database import (
    db_bulk_delete,
    db_copy_row,
    db_count,
    db_delete,
    db_execute,
    db_execute_script,
    db_exists,
    db_get,
    db_get_column_names,
    db_get_or_create,
    db_insert,
    db_insert_many,
    db_query,
    db_query_one,
    db_table_exists,
    db_transaction,
    db_truncate,
    db_update,
    db_upsert,
)
from venomqa.tools.email import (
    clear_emails,
    configure_email,
    count_emails,
    email_contains,
    email_to_plain_text,
    extract_all_codes,
    extract_code_from_email,
    extract_links_from_email,
    extract_otp_code,
    extract_verification_link,
    get_email_by_subject,
    get_email_recipients,
    get_latest_email,
    list_emails,
    send_test_email,
    wait_for_email,
)
from venomqa.tools.http import (
    WebSocketConnection,
    WebSocketError,
    delete,
    download_file,
    follow_redirects,
    get,
    get_json_or_none,
    get_response_size,
    graphql_mutation,
    graphql_query,
    head,
    is_json_response,
    options,
    patch,
    post,
    put,
    request,
    upload_file,
    websocket_close,
    websocket_connect,
    websocket_receive,
    websocket_send,
)
from venomqa.tools.mock import (
    MockResponseBuilder,
    clear_mocks,
    configure_mock,
    get_mock_requests,
    mock_auth_required_response,
    mock_error_response,
    mock_paginated_response,
    mock_rate_limited_response,
    mock_server_error_response,
    mock_success_response,
    remove_mock,
    reset_mock_requests,
    setup_mock,
    setup_mock_sequence,
    verify_mock_called,
)
from venomqa.tools.wait import (
    poll,
    retry_on_failure,
    wait_all,
    wait_any,
    wait_for_condition,
    wait_for_email_received,
    wait_for_health_check,
    wait_for_json_path,
    wait_for_response,
    wait_for_retry_success,
    wait_for_stable_value,
    wait_for_status,
    wait_for_value_change,
    wait_until,
)

__all__ = [
    # HTTP tools
    "get",
    "post",
    "put",
    "patch",
    "delete",
    "head",
    "options",
    "request",
    "graphql_query",
    "graphql_mutation",
    "websocket_connect",
    "websocket_send",
    "websocket_receive",
    "websocket_close",
    "WebSocketConnection",
    "WebSocketError",
    "upload_file",
    "download_file",
    "follow_redirects",
    "get_response_size",
    "is_json_response",
    "get_json_or_none",
    # Auth tools
    "basic_auth",
    "api_key_auth",
    "bearer_token_auth",
    "oauth2_login",
    "oauth2_client_credentials",
    "oauth2_refresh_token",
    "jwt_login",
    "set_auth_context",
    "get_auth_headers",
    "decode_jwt_payload",
    "is_token_expired",
    "ensure_authenticated",
    "clear_auth",
    "get_token_claims",
    "has_scope",
    "get_user_id",
    "get_token_expiration",
    "get_time_until_expiration",
    "switch_user",
    "create_auth_header",
    "is_authenticated",
    # Database tools
    "db_query",
    "db_query_one",
    "db_insert",
    "db_insert_many",
    "db_update",
    "db_delete",
    "db_upsert",
    "db_execute",
    "db_transaction",
    "db_table_exists",
    "db_truncate",
    "db_count",
    "db_exists",
    "db_get",
    "db_get_or_create",
    "db_get_column_names",
    "db_bulk_delete",
    "db_copy_row",
    "db_execute_script",
    # Wait tools
    "wait_for_response",
    "wait_for_status",
    "wait_for_condition",
    "wait_until",
    "wait_for_health_check",
    "wait_for_json_path",
    "wait_for_email_received",
    "poll",
    "retry_on_failure",
    "wait_for_value_change",
    "wait_for_stable_value",
    "wait_all",
    "wait_any",
    "wait_for_retry_success",
    # Assertion tools (protocol-agnostic)
    "assert_status",
    "assert_json_path_generic",
    "assert_header_generic",
    "assert_schema",
    # Assertion tools (httpx-specific)
    "assert_status_code",
    "assert_status_ok",
    "assert_status_created",
    "assert_status_no_content",
    "assert_status_bad_request",
    "assert_status_unauthorized",
    "assert_status_forbidden",
    "assert_status_not_found",
    "assert_status_client_error",
    "assert_status_server_error",
    "assert_response_time",
    "assert_response_time_range",
    "assert_json_schema",
    "assert_json_path",
    "assert_json_contains",
    "assert_json_list_length",
    "assert_contains",
    "assert_not_contains",
    "assert_matches_regex",
    "assert_header",
    "assert_header_exists",
    "assert_header_contains",
    "assert_content_type",
    "assert_json_type",
    "assert_custom",
    "assert_redirect",
    "assert_redirect_to",
    "assert_length",
    "assert_json_keys",
    "assert_json_has_key",
    "assert_is_empty",
    "assert_is_not_empty",
    "assert_starts_with",
    "assert_ends_with",
    "assert_cookie_exists",
    "assert_cookie_value",
    "assert_json_value_greater_than",
    "assert_json_value_less_than",
    "assert_json_value_between",
    "assert_json_value_equals",
    "assert_all",
    # Email tools
    "get_latest_email",
    "get_email_by_subject",
    "list_emails",
    "wait_for_email",
    "clear_emails",
    "extract_links_from_email",
    "extract_code_from_email",
    "send_test_email",
    "configure_email",
    "extract_verification_link",
    "extract_otp_code",
    "extract_all_codes",
    "email_to_plain_text",
    "email_contains",
    "get_email_recipients",
    "count_emails",
    # Mock tools
    "setup_mock",
    "setup_mock_sequence",
    "remove_mock",
    "clear_mocks",
    "verify_mock_called",
    "get_mock_requests",
    "configure_mock",
    "reset_mock_requests",
    "MockResponseBuilder",
    "mock_success_response",
    "mock_error_response",
    "mock_paginated_response",
    "mock_auth_required_response",
    "mock_rate_limited_response",
    "mock_server_error_response",
]
