#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
#import "./issue.fragment.graphql"

query getIssues(
  $isProject: Boolean = false
  $isSignedIn: Boolean = false
  $fullPath: ID!
  $iid: String
  $search: String
  $sort: IssueSort
  $state: IssuableState
  $assigneeId: String
  $assigneeUsernames: [String!]
  $authorUsername: String
  $confidential: Boolean
  $labelName: [String]
  $milestoneTitle: [String]
  $milestoneWildcardId: MilestoneWildcardId
  $myReactionEmoji: String
  $releaseTag: [String!]
  $releaseTagWildcardId: ReleaseTagWildcardId
  $types: [IssueType!]
  $not: NegatedIssueFilterInput
  $beforeCursor: String
  $afterCursor: String
  $firstPageSize: Int
  $lastPageSize: Int
) {
  group(fullPath: $fullPath) @skip(if: $isProject) {
    id
    issues(
      includeSubgroups: true
      iid: $iid
      search: $search
      sort: $sort
      state: $state
      assigneeId: $assigneeId
      assigneeUsernames: $assigneeUsernames
      authorUsername: $authorUsername
      confidential: $confidential
      labelName: $labelName
      milestoneTitle: $milestoneTitle
      milestoneWildcardId: $milestoneWildcardId
      myReactionEmoji: $myReactionEmoji
      types: $types
      not: $not
      before: $beforeCursor
      after: $afterCursor
      first: $firstPageSize
      last: $lastPageSize
    ) {
      pageInfo {
        ...PageInfo
      }
      nodes {
        ...IssueFragment
        reference(full: true)
      }
    }
  }
  project(fullPath: $fullPath) @include(if: $isProject) {
    id
    issues(
      iid: $iid
      search: $search
      sort: $sort
      state: $state
      assigneeId: $assigneeId
      assigneeUsernames: $assigneeUsernames
      authorUsername: $authorUsername
      confidential: $confidential
      labelName: $labelName
      milestoneTitle: $milestoneTitle
      milestoneWildcardId: $milestoneWildcardId
      myReactionEmoji: $myReactionEmoji
      releaseTag: $releaseTag
      releaseTagWildcardId: $releaseTagWildcardId
      types: $types
      not: $not
      before: $beforeCursor
      after: $afterCursor
      first: $firstPageSize
      last: $lastPageSize
    ) {
      pageInfo {
        ...PageInfo
      }
      nodes {
        ...IssueFragment
      }
    }
  }
}
