# Example GraphQL Queries for Maternal App

# ========================================
# Dashboard Query - Optimized Single Query
# ========================================
# This query replaces multiple REST API calls:
# - GET /api/v1/children
# - GET /api/v1/tracking/child/:id/recent
# - GET /api/v1/tracking/child/:id/summary/today
# - GET /api/v1/families/:id/members

query GetDashboard($childId: ID) {
  dashboard(childId: $childId) {
    # Children list
    children {
      id
      name
      birthDate
      gender
      photoUrl
    }

    # Selected child (specified or first)
    selectedChild {
      id
      name
      birthDate
      gender
      photoUrl
    }

    # Recent activities (last 10 for selected child)
    recentActivities {
      id
      type
      startedAt
      endedAt
      notes
      metadata
      logger {
        id
        name
      }
    }

    # Today's summary for selected child
    todaySummary {
      date
      feedingCount
      totalFeedingAmount
      sleepCount
      totalSleepDuration
      diaperCount
      medicationCount
    }

    # Family members
    familyMembers {
      userId
      role
      user {
        id
        name
        email
      }
    }

    # Aggregations
    totalChildren
    totalActivitiesToday
  }
}

# Example Variables:
# {
#   "childId": "child_abc123"
# }

# ========================================
# Dashboard Query - All Children
# ========================================
# Get dashboard data without specifying a child
# (will return first child's data)

query GetDashboardAllChildren {
  dashboard {
    children {
      id
      name
      birthDate
    }
    selectedChild {
      id
      name
    }
    totalChildren
    totalActivitiesToday
  }
}
