{
  "legacybet_application": {
    "name": "LegacyBet Betting Platform",
    "description": "A comprehensive online betting platform featuring sports, casino games, administrative tools, and robust user management, with transactions in Kenyan Shillings.",
    "base_api_url": "https://api.legacybet.com/v1",
    "features": [
      {
        "name": "Home",
        "description": "The main landing page displaying featured content, popular sports, live matches, and quick links.",
        "functionalities": [
          {
            "name": "Get Featured Content",
            "method": "GET",
            "endpoint": "/home/featured",
            "description": "Retrieves banners, promotions, and top matches to display on the home screen.",
            "authentication_required": false
          },
          {
            "name": "Get Popular Sports",
            "method": "GET",
            "endpoint": "/home/popular-sports",
            "description": "Lists currently popular sports categories.",
            "authentication_required": false
          }
        ]
      },
      {
        "name": "Football Betting",
        "description": "Comprehensive section for football matches, odds, and betting options.",
        "functionalities": [
          {
            "name": "Get All Football Leagues",
            "method": "GET",
            "endpoint": "/sports/football/leagues",
            "description": "Fetches a list of all available football leagues.",
            "authentication_required": false
          },
          {
            "name": "Get Upcoming Football Matches",
            "method": "GET",
            "endpoint": "/sports/football/matches/upcoming",
            "description": "Retrieves a list of upcoming football matches with basic odds.",
            "parameters": [
              {"name": "league_id", "type": "string", "optional": true},
              {"name": "date", "type": "string", "format": "YYYY-MM-DD", "optional": true}
            ],
            "authentication_required": false
          },
          {
            "name": "Get Live Football Matches",
            "method": "GET",
            "endpoint": "/sports/football/matches/live",
            "description": "Retrieves a list of live football matches with real-time odds updates.",
            "authentication_required": false
          },
          {
            "name": "Get Match Details and Odds",
            "method": "GET",
            "endpoint": "/sports/football/matches/{match_id}",
            "description": "Fetches detailed information and all available betting markets for a specific football match.",
            "parameters": [
              {"name": "match_id", "type": "string", "required": true, "description": "Unique identifier for the match"}
            ],
            "authentication_required": false
          }
        ]
      },
      {
        "name": "Basketball Betting",
        "description": "Comprehensive section for basketball matches, odds, and betting options.",
        "functionalities": [
          {
            "name": "Get All Basketball Leagues",
            "method": "GET",
            "endpoint": "/sports/basketball/leagues",
            "description": "Fetches a list of all available basketball leagues.",
            "authentication_required": false
          },
          {
            "name": "Get Upcoming Basketball Matches",
            "method": "GET",
            "endpoint": "/sports/basketball/matches/upcoming",
            "description": "Retrieves a list of upcoming basketball matches with basic odds.",
            "authentication_required": false
          },
          {
            "name": "Get Live Basketball Matches",
            "method": "GET",
            "endpoint": "/sports/basketball/matches/live",
            "description": "Retrieves a list of live basketball matches with real-time odds updates.",
            "authentication_required": false
          },
          {
            "name": "Get Match Details and Odds",
            "method": "GET",
            "endpoint": "/sports/basketball/matches/{match_id}",
            "description": "Fetches detailed information and all available betting markets for a specific basketball match.",
            "parameters": [
              {"name": "match_id", "type": "string", "required": true, "description": "Unique identifier for the match"}
            ],
            "authentication_required": false
          }
        ]
      },
      {
        "name": "Aviator Game",
        "description": "Access to the Aviator crash game.",
        "functionalities": [
          {
            "name": "Launch Aviator Game",
            "method": "GET",
            "endpoint": "/games/aviator/launch",
            "description": "Generates a URL or token to launch the Aviator game in a separate window or iframe.",
            "authentication_required": true
          }
        ]
      },
      {
        "name": "Jackpot Games",
        "description": "Section for participating in jackpot pools with large prizes.",
        "functionalities": [
          {
            "name": "Get Available Jackpots",
            "method": "GET",
            "endpoint": "/jackpots",
            "description": "Lists all active jackpot games with their rules and prize amounts.",
            "authentication_required": false
          },
          {
            "name": "Submit Jackpot Entry",
            "method": "POST",
            "endpoint": "/jackpots/{jackpot_id}/entry",
            "description": "Submits a user's selections for a specific jackpot.",
            "authentication_required": true,
            "parameters": [
              {"name": "jackpot_id", "type": "string", "required": true, "description": "Unique identifier for the jackpot"},
              {"name": "selections", "type": "array", "required": true, "description": "User's predictions for the jackpot matches"}
            ]
          }
        ]
      },
      {
        "name": "Matches (General)",
        "description": "General overview of matches across various sports.",
        "functionalities": [
          {
            "name": "Get All Upcoming Matches",
            "method": "GET",
            "endpoint": "/matches/upcoming",
            "description": "Retrieves a consolidated list of upcoming matches from all available sports.",
            "parameters": [
              {"name": "sport", "type": "string", "optional": true},
              {"name": "date", "type": "string", "format": "YYYY-MM-DD", "optional": true}
            ],
            "authentication_required": false
          },
          {
            "name": "Get All Live Matches",
            "method": "GET",
            "endpoint": "/matches/live",
            "description": "Retrieves a consolidated list of live matches from all available sports.",
            "authentication_required": false
          }
        ]
      },
      {
        "name": "User Registration and Login",
        "description": "Manages user account creation and authentication.",
        "functionalities": [
          {
            "name": "Register User",
            "method": "POST",
            "endpoint": "/auth/register",
            "description": "Creates a new user account.",
            "authentication_required": false,
            "parameters": [
              {"name": "phone_number", "type": "string", "required": true, "description": "User's phone number (e.g., +254XXXXXXXXX)"},
              {"name": "password", "type": "string", "required": true, "description": "User's chosen password"}
            ],
            "response_example": {"message": "Registration successful", "user_id": "...", "token": "..."}
          },
          {
            "name": "Login User",
            "method": "POST",
            "endpoint": "/auth/login",
            "description": "Authenticates a user and provides an access token.",
            "authentication_required": false,
            "parameters": [
              {"name": "phone_number", "type": "string", "required": true, "description": "User's phone number"},
              {"name": "password", "type": "string", "required": true, "description": "User's password"}
            ],
            "response_example": {"message": "Login successful", "token": "jwt_token_here", "user": {"id": "...", "username": "..."}}
          },
          {
            "name": "Forgot Password",
            "method": "POST",
            "endpoint": "/auth/forgot-password",
            "description": "Initiates a password reset process, usually sending an SMS/email.",
            "authentication_required": false,
            "parameters": [
              {"name": "phone_number", "type": "string", "required": true, "description": "User's registered phone number"}
            ]
          }
        ]
      },
      {
        "name": "Wallet (Kenyan Shillings)",
        "description": "Manages user's financial balance in Kenyan Shillings (KES).",
        "functionalities": [
          {
            "name": "Get Wallet Balance",
            "method": "GET",
            "endpoint": "/wallet/balance",
            "description": "Retrieves the current balance of the user's wallet.",
            "authentication_required": true,
            "response_example": {"balance": 1500.75, "currency": "KES"}
          },
          {
            "name": "Deposit Funds",
            "method": "POST",
            "endpoint": "/wallet/deposit",
            "description": "Initiates a deposit transaction into the user's wallet.",
            "authentication_required": true,
            "parameters": [
              {"name": "amount", "type": "number", "required": true, "description": "Amount to deposit in KES"},
              {"name": "method", "type": "string", "required": true, "description": "Payment method (e.g., M-Pesa)"}
            ]
          },
          {
            "name": "Withdraw Funds",
            "method": "POST",
            "endpoint": "/wallet/withdraw",
            "description": "Initiates a withdrawal transaction from the user's wallet.",
            "authentication_required": true,
            "parameters": [
              {"name": "amount", "type": "number", "required": true, "description": "Amount to withdraw in KES"},
              {"name": "method", "type": "string", "required": true, "description": "Withdrawal method (e.g., M-Pesa)"}
            ]
          },
          {
            "name": "Get Transaction History",
            "method": "GET",
            "endpoint": "/wallet/transactions",
            "description": "Retrieves a list of all wallet transactions (deposits, withdrawals, bets).",
            "authentication_required": true,
            "parameters": [
              {"name": "limit", "type": "integer", "optional": true, "default": 20},
              {"name": "offset", "type": "integer", "optional": true, "default": 0}
            ]
          }
        ]
      },
      {
        "name": "Betslip",
        "description": "Manages the user's current selections before placing a bet.",
        "functionalities": [
          {
            "name": "Add Selection to Betslip",
            "method": "POST",
            "endpoint": "/betslip/add",
            "description": "Adds a betting market selection to the user's betslip.",
            "authentication_required": true,
            "parameters": [
              {"name": "match_id", "type": "string", "required": true},
              {"name": "market_id", "type": "string", "required": true},
              {"name": "outcome_id", "type": "string", "required": true},
              {"name": "odds", "type": "number", "required": true}
            ]
          },
          {
            "name": "Remove Selection from Betslip",
            "method": "DELETE",
            "endpoint": "/betslip/remove",
            "description": "Removes a specific selection from the user's betslip.",
            "authentication_required": true,
            "parameters": [
              {"name": "selection_id", "type": "string", "required": true, "description": "Identifier of the selection to remove"}
            ]
          },
          {
            "name": "Get Current Betslip",
            "method": "GET",
            "endpoint": "/betslip",
            "description": "Retrieves the current state of the user's betslip, including total odds and potential winnings.",
            "authentication_required": true
          },
          {
            "name": "Place Bet",
            "method": "POST",
            "endpoint": "/betslip/place-bet",
            "description": "Submits the selections in the betslip as a final bet.",
            "authentication_required": true,
            "parameters": [
              {"name": "stake_amount", "type": "number", "required": true, "description": "Amount to stake in KES"},
              {"name": "bet_type", "type": "string", "required": true, "enum": ["single", "multi", "system"], "description": "Type of bet to place"}
            ]
          }
        ]
      },
      {
        "name": "Bet History",
        "description": "Allows users to view their past and active bets.",
        "functionalities": [
          {
            "name": "Get All Bets",
            "method": "GET",
            "endpoint": "/bet-history",
            "description": "Retrieves a list of all placed bets by the user.",
            "authentication_required": true,
            "parameters": [
              {"name": "status", "type": "string", "optional": true, "enum": ["active", "settled", "won", "lost"]},
              {"name": "from_date", "type": "string", "format": "YYYY-MM-DD", "optional": true},
              {"name": "to_date", "type": "string", "format": "YYYY-MM-DD", "optional": true},
              {"name": "limit", "type": "integer", "optional": true, "default": 20}
            ]
          },
          {
            "name": "Get Bet Details",
            "method": "GET",
            "endpoint": "/bet-history/{bet_id}",
            "description": "Retrieves detailed information for a specific bet.",
            "authentication_required": true,
            "parameters": [
              {"name": "bet_id", "type": "string", "required": true, "description": "Unique identifier for the bet"}
            ]
          }
        ]
      },
      {
        "name": "Promotion",
        "description": "Displays available promotions and allows users to claim them.",
        "functionalities": [
          {
            "name": "Get Available Promotions",
            "method": "GET",
            "endpoint": "/promotions",
            "description": "Fetches a list of all active promotions and bonuses.",
            "authentication_required": false
          },
          {
            "name": "Claim Promotion",
            "method": "POST",
            "endpoint": "/promotions/{promo_id}/claim",
            "description": "Allows a logged-in user to claim a specific promotion.",
            "authentication_required": true,
            "parameters": [
              {"name": "promo_id", "type": "string", "required": true, "description": "Unique identifier for the promotion"}
            ]
          }
        ]
      },
      {
        "name": "Cash Out",
        "description": "Enables users to cash out early on active bets.",
        "functionalities": [
          {
            "name": "Get Cash Out Offer",
            "method": "GET",
            "endpoint": "/bets/{bet_id}/cashout-offer",
            "description": "Retrieves the current cash out offer for an active bet.",
            "authentication_required": true,
            "parameters": [
              {"name": "bet_id", "type": "string", "required": true, "description": "Unique identifier for the active bet"}
            ],
            "response_example": {"cashout_amount": 750.00, "currency": "KES", "available": true}
          },
          {
            "name": "Perform Cash Out",
            "method": "POST",
            "endpoint": "/bets/{bet_id}/cashout",
            "description": "Executes a cash out for an active bet.",
            "authentication_required": true,
            "parameters": [
              {"name": "bet_id", "type": "string", "required": true, "description": "Unique identifier for the active bet"},
              {"name": "requested_amount", "type": "number", "optional": true, "description": "The amount user wants to cash out, if different from full offer"}
            ]
          }
        ]
      },
      {
        "name": "Privacy Policy",
        "description": "Displays the platform's privacy policy.",
        "functionalities": [
          {
            "name": "Get Privacy Policy",
            "method": "GET",
            "endpoint": "/legal/privacy-policy",
            "description": "Retrieves the full text of the privacy policy.",
            "authentication_required": false
          }
        ]
      },
      {
        "name": "Terms and Conditions",
        "description": "Displays the platform's terms and conditions.",
        "functionalities": [
          {
            "name": "Get Terms and Conditions",
            "method": "GET",
            "endpoint": "/legal/terms-and-conditions",
            "description": "Retrieves the full text of the terms and conditions.",
            "authentication_required": false
          }
        ]
      },
      {
        "name": "Admin Panel",
        "description": "Management interface for administrators, requiring elevated privileges.",
        "functionalities": [
          {
            "name": "Admin Login",
            "method": "POST",
            "endpoint": "/admin/auth/login",
            "description": "Authenticates an administrator.",
            "authentication_required": false,
            "parameters": [
              {"name": "username", "type": "string", "required": true},
              {"name": "password", "type": "string", "required": true}
            ],
            "response_example": {"token": "admin_jwt_token"}
          },
          {
            "name": "Get All Users",
            "method": "GET",
            "endpoint": "/admin/users",
            "description": "Retrieves a list of all registered users.",
            "authentication_required": true,
            "required_role": "admin"
          },
          {
            "name": "Manage User Account",
            "method": "PUT",
            "endpoint": "/admin/users/{user_id}",
            "description": "Updates details or status of a specific user (e.g., block, unblock).",
            "authentication_required": true,
            "required_role": "admin",
            "parameters": [
              {"name": "user_id", "type": "string", "required": true},
              {"name": "status", "type": "string", "optional": true, "enum": ["active", "blocked"]},
              {"name": "balance_adjust", "type": "number", "optional": true, "description": "Adjust user balance (e.g., for bonuses/corrections)"}
            ]
          },
          {
            "name": "Manage Matches and Odds",
            "method": "POST",
            "endpoint": "/admin/matches",
            "description": "Adds a new match to the system.",
            "authentication_required": true,
            "required_role": "admin"
          },
          {
            "name": "Update Match Odds",
            "method": "PUT",
            "endpoint": "/admin/matches/{match_id}/odds",
            "description": "Updates odds for a specific match and market.",
            "authentication_required": true,
            "required_role": "admin",
            "parameters": [
              {"name": "match_id", "type": "string", "required": true},
              {"name": "market_id", "type": "string", "required": true},
              {"name": "outcome_id", "type": "string", "required": true},
              {"name": "new_odds", "type": "number", "required": true}
            ]
          },
          {
            "name": "Settle Bet",
            "method": "POST",
            "endpoint": "/admin/bets/{bet_id}/settle",
            "description": "Manually settles a bet as won or lost, and distributes winnings.",
            "authentication_required": true,
            "required_role": "admin",
            "parameters": [
              {"name": "bet_id", "type": "string", "required": true},
              {"name": "status", "type": "string", "required": true, "enum": ["won", "lost", "void"]}
            ]
          },
          {
            "name": "Manage Promotions",
            "method": "POST",
            "endpoint": "/admin/promotions",
            "description": "Creates or updates promotions.",
            "authentication_required": true,
            "required_role": "admin"
          }
        ]
      }
    ]
  }
}