"""
RBAC permission mapping for all tool schemas.
Maps schema tool name → security ActionType string.
"""

TOOL_PERMISSIONS = {
    # File / System
    "execute_command": "system_command",
    "read_file": "file_read",
    "write_file": "file_write",
    "edit_file": "file_write",
    "delete_file": "file_delete",
    "move_file": "file_write",
    "copy_file": "file_write",
    "create_directory": "file_write",
    # Browser
    "browser_search": "browser_navigate",
    "browser_scrape": "browser_navigate",
    "browser_snapshot": "browser_navigate",
    "browser_action": "browser_navigate",
    # Code execution
    "execute_code": "system_command",
    # Dynamic skills
    "create_skill": "system_command",
    "delete_skill": "system_command",
    "disable_skill": "system_command",
    "enable_skill": "system_command",
    "list_skills": "file_read",
    # Desktop control
    "desktop_screenshot": "system_command",
    "desktop_click": "system_command",
    "desktop_type": "system_command",
    "desktop_hotkey": "system_command",
    # Document & email
    "email_send": "email_send",
    "email_read": "email_read",
    "create_document": "file_write",
    "create_spreadsheet": "file_write",
    "create_pdf": "file_write",
    "create_presentation": "file_write",
    "open_document": "system_command",
    "write_in_writer": "system_command",
    "clipboard_copy": "system_command",
    "clipboard_paste": "system_command",
    # Trading
    "trading_portfolio": "trading_read",
    "trading_price": "trading_read",
    "trading_analyze": "trading_read",
    "trading_signals": "trading_read",
    "trading_history": "trading_read",
    "trading_risk_status": "trading_read",
    "trading_place_trade": "trading_execute",
    "trading_cancel_order": "trading_execute",
    "trading_start_scan": "trading_execute",
    "trading_stop_scan": "trading_execute",
    # Instagram
    "ig_upload_photo": "social_write",
    "ig_upload_reel": "social_write",
    "ig_upload_story": "social_write",
    "ig_search_users": "social_read",
    "ig_search_hashtags": "social_read",
    "ig_get_user_info": "social_read",
    "ig_get_timeline": "social_read",
    "ig_like_media": "social_write",
    "ig_comment": "social_write",
    "ig_follow_user": "social_write",
    "ig_send_dm": "social_write",
    "ig_get_media_comments": "social_read",
    # Facebook
    "fb_post": "social_write",
    "fb_upload_photo": "social_write",
    "fb_get_feed": "social_read",
    "fb_like_post": "social_write",
    "fb_comment": "social_write",
    "fb_get_profile": "social_read",
    "fb_search": "social_read",
    # LinkedIn
    "linkedin_get_profile": "social_read",
    "linkedin_search_people": "social_read",
    "linkedin_search_companies": "social_read",
    "linkedin_search_jobs": "social_read",
    "linkedin_post_update": "social_write",
    "linkedin_send_message": "social_write",
    "linkedin_send_connection": "social_write",
    "linkedin_get_feed": "social_read",
    # TikTok (read-only)
    "tiktok_trending": "social_read",
    "tiktok_search_videos": "social_read",
    "tiktok_search_users": "social_read",
    "tiktok_get_user_info": "social_read",
    "tiktok_get_user_videos": "social_read",
    "tiktok_get_hashtag_videos": "social_read",
    # YouTube
    "yt_search_videos": "social_read",
    "yt_search_channels": "social_read",
    "yt_get_channel": "social_read",
    "yt_get_channel_videos": "social_read",
    "yt_get_video": "social_read",
    "yt_get_comments": "social_read",
    "yt_comment": "social_write",
    "yt_get_playlist": "social_read",
    "yt_rate_video": "social_write",
    "yt_subscribe": "social_write",
    "yt_trending": "social_read",
    "yt_upload_video": "social_write",
    # Skills Marketplace
    "marketplace_search": "marketplace_read",
    "marketplace_info": "marketplace_read",
    "marketplace_install": "marketplace_install",
    "marketplace_review": "marketplace_write",
    # Mobile phone
    "phone_notify": "mobile_write",
    "phone_reminder": "mobile_write",
    "phone_geofence": "mobile_write",
    "phone_location": "mobile_read",
    "phone_device": "mobile_read",
    # GitHub
    "github_create_issue": "github_write",
    "github_list_issues": "github_read",
    "github_comment_issue": "github_write",
    "github_close_issue": "github_write",
    "github_create_pr": "github_write",
    "github_list_prs": "github_read",
    "github_merge_pr": "github_write",
    "github_repo_info": "github_read",
    "github_list_repos": "github_read",
    "github_create_branch": "github_write",
    "github_search_code": "github_read",
    "github_get_file": "github_read",
    "github_create_release": "github_write",

    # Google Workspace
    "gws_gmail_list": "gws_read",
    "gws_gmail_get": "gws_read",
    "gws_gmail_send": "gws_write",
    "gws_drive_list": "gws_read",
    "gws_drive_get": "gws_read",
    "gws_drive_search": "gws_read",
    "gws_drive_upload": "gws_write",
    "gws_drive_create": "gws_write",
    "gws_calendar_list": "gws_read",
    "gws_calendar_create": "gws_write",
    "gws_calendar_delete": "gws_write",
    "gws_sheets_get": "gws_read",
    "gws_sheets_write": "gws_write",
    "gws_sheets_create": "gws_write",
    "gws_sheets_append": "gws_write",
    "gws_docs_get": "gws_read",
    "gws_docs_create": "gws_write",
    "gws_chat_send": "gws_write",
    "gws_raw_command": "gws_write",
    "gws_auth_status": "gws_read",
    # Arena Fighter
    "arena_fight": "arena_write",
    "arena_status": "arena_read",
    "arena_history": "arena_read",
    "arena_disconnect": "arena_write",
    # Zunvra Social Network
    "zunvra_post": "zunvra_write",
    "zunvra_reply": "zunvra_write",
    "zunvra_like": "zunvra_write",
    "zunvra_repost": "zunvra_write",
    "zunvra_follow": "zunvra_write",
    "zunvra_unfollow": "zunvra_write",
    "zunvra_feed": "zunvra_read",
    "zunvra_trending": "zunvra_read",
    "zunvra_get_user": "zunvra_read",
    "zunvra_get_post": "zunvra_read",
    "zunvra_send_dm": "zunvra_write",
    "zunvra_conversations": "zunvra_read",
    "zunvra_notifications": "zunvra_read",
    "zunvra_whoami": "zunvra_read",
    # AgentMon League (Pokémon Red)
    "agentmon_start": "agentmon_play",
    "agentmon_stop": "agentmon_play",
    "agentmon_step": "agentmon_play",
    "agentmon_actions": "agentmon_play",
    "agentmon_state": "agentmon_read",
    "agentmon_frame": "agentmon_read",
    "agentmon_save": "agentmon_play",
    "agentmon_saves": "agentmon_read",
    "agentmon_delete_save": "agentmon_play",
    "agentmon_leaderboard": "agentmon_read",
    # Business Automation,  CRM
    "crm_add_contact": "crm_write",
    "crm_search_contacts": "crm_read",
    "crm_get_contact": "crm_read",
    "crm_update_contact": "crm_write",
    "crm_delete_contact": "crm_write",
    "crm_log_activity": "crm_write",
    "crm_get_activities": "crm_read",
    "crm_stats": "crm_read",
    # Business Automation,  Pipeline
    "pipeline_create_deal": "pipeline_write",
    "pipeline_advance_deal": "pipeline_write",
    "pipeline_get_deal": "pipeline_read",
    "pipeline_list_deals": "pipeline_read",
    "pipeline_update_deal": "pipeline_write",
    "pipeline_stats": "pipeline_read",
    "pipeline_match": "pipeline_read",
    # Business Automation,  Email Templates
    "template_list": "template_read",
    "template_get": "template_read",
    "template_save": "template_write",
    "template_render": "template_read",
    "template_delete": "template_write",
    # Business Automation,  Follow-ups
    "followup_recommendations": "followup_read",
    "followup_overdue": "followup_read",
    "followup_stale": "followup_read",
    "followup_summary": "followup_read",
}
