#import "../fragments/vulnerability.fragment.graphql"

query projectVulnerabilities(
  $fullPath: ID!
  $after: String
  $first: Int = 20
  $severity: [VulnerabilitySeverity!]
  $reportType: [VulnerabilityReportType!]
  $scanner: [String!]
  $scannerId: [VulnerabilitiesScannerID!]
  $state: [VulnerabilityState!]
  $sort: VulnerabilitySort
  $hasIssues: Boolean
  $hasResolution: Boolean
  $includeExternalIssueLinks: Boolean = false
  $vetEnabled: Boolean = false
) {
  project(fullPath: $fullPath) {
    id
    vulnerabilities(
      after: $after
      first: $first
      severity: $severity
      reportType: $reportType
      scanner: $scanner
      scannerId: $scannerId
      state: $state
      sort: $sort
      hasIssues: $hasIssues
      hasResolution: $hasResolution
    ) {
      nodes {
        ...VulnerabilityFragment
        externalIssueLinks @include(if: $includeExternalIssueLinks) {
          nodes {
            id
            issue: externalIssue {
              externalTracker
              webUrl
              title
              iid: relativeReference
            }
          }
        }
        hasSolutions
        mergeRequest {
          id
          webUrl
          state
          securityAutoFix
          iid
        }
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}
