{
  "app_info": {
    "name": "Owhen",
    "description": "An expense tracking app made for groups of friends",
    "creators": [
      "Josh Manzano",
      "Adrienne Soliven",
      "Rafael Cruz"
    ],
    "version": "1.0.0",
    "last_updated": "2026-05-12T01:28:19.486111+00:00"
  },
  "health": {
    "status": "healthy",
    "timestamp": "2026-05-12T01:28:19.486147+00:00",
    "service": "owhen-docs"
  },
  "services": {
    "transactions": {
      "service": "owhen-transactions",
      "description": "Manages financial transactions between users",
      "base_url": "/transactions",
      "endpoints": {
        "GET /transactions": {
          "description": "Get usage instructions and API documentation",
          "parameters": "None",
          "response": "API documentation and examples"
        },
        "GET /transactions/{transaction_id}": {
          "description": "Get a specific transaction by ID",
          "parameters": {
            "transaction_id": "string - Unique identifier for the transaction"
          },
          "response": "Transaction object with all details"
        },
        "POST /transactions": {
          "description": "Create a new transaction",
          "required_fields": [
            "transaction_id",
            "sender_id",
            "receiver_id"
          ],
          "optional_fields": [
            "amount",
            "currency",
            "description"
          ],
          "example_request": {
            "transaction_id": "txn_123",
            "sender_id": "user@example.com",
            "receiver_id": "friend@example.com",
            "amount": 25.5,
            "currency": "USD",
            "description": "Lunch split"
          }
        },
        "DELETE /transactions/{transaction_id}": {
          "description": "Delete a specific transaction by ID",
          "parameters": {
            "transaction_id": "string - Unique identifier for the transaction"
          },
          "response": "Confirmation of deletion"
        }
      },
      "data_storage": "Amazon DynamoDB",
      "table_name": "owhen_transactions"
    },
    "users": {
      "service": "owhen-users",
      "description": "Manages user accounts and profile information",
      "base_url": "/users",
      "endpoints": {
        "GET /users": {
          "description": "Get usage instructions and API documentation",
          "parameters": "None",
          "response": "API documentation and examples"
        },
        "GET /users/{email}": {
          "description": "Get a specific user by email address",
          "parameters": {
            "email": "string - User's email address (used as unique identifier)"
          },
          "response": "User object with profile and balance information"
        },
        "POST /users": {
          "description": "Create a new user account",
          "required_fields": [
            "email",
            "display_name",
            "nickname_mappings",
            "balances"
          ],
          "example_request": {
            "email": "user@example.com",
            "display_name": "John Doe",
            "nickname_mappings": {},
            "balances": {}
          }
        },
        "DELETE /users/{email}": {
          "description": "Delete a specific user by email address",
          "parameters": {
            "email": "string - User's email address"
          },
          "response": "Confirmation of deletion"
        }
      },
      "data_storage": "Amazon DynamoDB",
      "table_name": "owhen_users"
    },
    "balances": {
      "service": "owhen-balances",
      "description": "Automatically processes transactions and updates user balances with debt simplification",
      "trigger": "DynamoDB Stream from owhen_transactions table",
      "features": [
        "Automatic balance updates when transactions are created",
        "Debt simplification through mutual connections",
        "User creation if accounts don't exist",
        "Error logging and event tracking"
      ],
      "debt_simplification": {
        "description": "Reduces complex debt relationships by routing payments through mutual connections",
        "strategy": [
          "Find mutual connections between transaction participants",
          "Identify positive balances from mutual connections to sender",
          "Transfer debts starting with smallest amounts first",
          "Only create direct debt for remaining amount after simplification"
        ]
      },
      "data_storage": "Amazon DynamoDB",
      "table_name": "owhen_users",
      "logging": {
        "events": "S3 bucket: owhen-balances-log",
        "errors": "S3 bucket: owhen-balances-errors"
      }
    }
  },
  "architecture": {
    "infrastructure": "AWS Lambda Functions",
    "database": "Amazon DynamoDB",
    "storage": "Amazon S3",
    "api_gateway": "REST API endpoints"
  },
  "common_workflows": {
    "create_transaction": [
      "1. POST to /transactions with transaction details",
      "2. owhen-balances automatically processes the transaction",
      "3. User balances are updated with debt simplification applied",
      "4. Transaction and balance changes are logged"
    ],
    "check_balances": [
      "1. GET /users/{email} to retrieve user profile",
      "2. Review 'balances' object for all relationships",
      "3. Positive values = others owe this user money",
      "4. Negative values = this user owes money to others"
    ]
  }
}