# Example GraphQL queries for testing the blog API

# Query 1: Get all users with their stats
query GetUsers {
  users(limit: 10) {
    id
    username
    fullName
    bio
    publishedPostCount
    commentCount
    createdAt
  }
}

# Query 2: Get a specific user
query GetUser {
  user(id: "00000000-0000-0000-0000-000000000001") {
    username
    fullName
    publishedPostCount
    commentCount
  }
}

# Query 3: Get all posts with nested data
query GetPosts {
  posts(publishedOnly: true, limit: 10) {
    id
    title
    content
    published
    author {
      id
      username
      fullName
    }
    commentCount
    comments {
      id
      content
      author {
        username
        fullName
      }
      createdAt
    }
    createdAt
  }
}

# Query 4: Get a specific post
query GetPost {
  post(id: "00000000-0000-0000-0001-000000000001") {
    title
    content
    author {
      username
    }
    comments {
      content
      author {
        username
      }
    }
  }
}

# Query 5: Get sync metrics
query GetSyncMetrics {
  syncMetrics(entityType: "post") {
    entityType
    totalSyncs24h
    avgDurationMs
    successRate
    failures24h
  }
}

# Mutation 1: Create a new user
mutation CreateUser {
  createUser(
    email: "newuser@example.com"
    username: "newuser"
    fullName: "New User"
    bio: "I'm new here!"
  ) {
    id
    username
    fullName
  }
}

# Mutation 2: Create a new post
mutation CreatePost {
  createPost(
    title: "My First Post"
    content: "This is my first post on this blog!"
    authorId: "00000000-0000-0000-0000-000000000001"
    published: true
  ) {
    id
    title
    author {
      username
    }
    createdAt
  }
}

# Mutation 3: Add a comment
mutation AddComment {
  createComment(
    postId: "00000000-0000-0000-0001-000000000001"
    authorId: "00000000-0000-0000-0000-000000000002"
    content: "Great post! I really enjoyed reading this."
  ) {
    id
    content
    author {
      username
    }
  }
}

# Mutation 4: Publish a post
mutation PublishPost {
  publishPost(postId: "00000000-0000-0000-0001-000000000002") {
    id
    title
    published
  }
}
