query GetBasicVideo($where: VideoWhereUniqueInput!) {
  videoByUniqueInput(where: $where) {
    ...BasicVideoFields
  }
}

query GetFullVideo($where: VideoWhereUniqueInput!) {
  videoByUniqueInput(where: $where) {
    ...FullVideoFields
  }
}

query GetBasicVideosConnection(
  $first: Int
  $after: String
  $orderBy: [VideoOrderByInput!] = [createdAt_DESC]
  $where: VideoWhereInput
) {
  videosConnection(first: $first, after: $after, where: $where, orderBy: $orderBy) {
    edges {
      cursor
      node {
        ...BasicVideoFields
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
    totalCount
  }
}

query GetFullVideosConnection(
  $first: Int
  $after: String
  $orderBy: [VideoOrderByInput!] = [createdAt_DESC]
  $where: VideoWhereInput
) {
  videosConnection(first: $first, after: $after, where: $where, orderBy: $orderBy) {
    edges {
      cursor
      node {
        ...FullVideoFields
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
    totalCount
  }
}

query GetBasicVideos(
  $offset: Int
  $limit: Int
  $where: VideoWhereInput
  $orderBy: [VideoOrderByInput!] = [createdAt_DESC]
) {
  videos(offset: $offset, limit: $limit, where: $where, orderBy: $orderBy) {
    ...BasicVideoFields
  }
}

query GetFullVideos(
  $offset: Int
  $limit: Int
  $where: VideoWhereInput
  $orderBy: [VideoOrderByInput!] = [createdAt_DESC]
) {
  videos(offset: $offset, limit: $limit, where: $where, orderBy: $orderBy) {
    ...FullVideoFields
  }
}

query GetMostViewedVideosConnection(
  $limit: Int = 50
  $periodDays: Int
  $first: Int
  $after: String
  $orderBy: [VideoOrderByInput!] = [createdAt_DESC]
  $where: VideoWhereInput
) {
  mostViewedVideosConnection(
    limit: $limit
    first: $first
    after: $after
    periodDays: $periodDays
    orderBy: $orderBy
    where: $where
  ) {
    edges {
      cursor
      node {
        ...BasicVideoFields
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
    totalCount
  }
}

query GetTop10VideosThisWeek($where: VideoWhereInput) {
  top10VideosThisWeek(where: $where) {
    ...BasicVideoFields
  }
}

query GetTop10VideosThisMonth($where: VideoWhereInput) {
  top10VideosThisMonth(where: $where) {
    ...BasicVideoFields
  }
}

mutation AddVideoView($videoId: ID!, $channelId: ID!, $categoryId: ID) {
  addVideoView(videoId: $videoId, channelId: $channelId, categoryId: $categoryId) {
    id
    views
  }
}

mutation ReportVideo($videoId: ID!, $rationale: String!) {
  reportVideo(videoId: $videoId, rationale: $rationale) {
    id
    videoId
  }
}
