#import TestFragment from "../fragments/test.graphql"

mutation createOrUpdateTestSuite(
  $testSuiteId: String!
  $title: String!
  $description: String!
  $projectId: String!
) {
  updateTestSuite(
    testSuiteId: $testSuiteId
    title: $title
    description: $description
    projectId: $projectId
  ) {
    testSuite {
      description
      id
      org
      title
      project {
        slug
      }
    }
  }
}

mutation addBatchTests(
  $test_info: [TestMutationInfo!]!
  $createOnly: Boolean!
) {
  batchUpdateTest(tests: $test_info, createOnly: $createOnly) {
    tests {
      ...TestFragment
    }
  }
}

mutation deleteTestSuite($testSuiteId: String!) {
  deleteSuite(suiteId: $testSuiteId) {
    success
  }
}

mutation updateGlobalChecks(
  $testSuiteId: String!
  $checks: [CheckInputType!]!
) {
  updateGlobalChecks(testSuiteId: $testSuiteId, checks: $checks) {
    success
  }
}

mutation removeOldTests($testSuiteId: String!, $inUseTests: [String!]!) {
  removeUnusedTests(testSuiteId: $testSuiteId, inUseTests: $inUseTests) {
    success
  }
}

mutation RerunTests($runId: String!) {
  rerunFailingTests(runId: $runId) {
    success
  }
}

mutation uploadLocalEvaluation(
  $questionAnswerSetId: String!
  $localEvals: [LocalEvalUploadInputType!]!
) {
  uploadLocalEvaluation(
    questionAnswerSetId: $questionAnswerSetId
    localEvals: $localEvals
  ) {
    uploads {
      id
      score
      feedback
      createdAt
    }
  }
}

mutation setCustomMetrics(
  $testSuiteId: String!
  $ids: [String!]!
) {
  setCustomMetrics(testSuiteId: $testSuiteId, ids: $ids) {
    success
  }
}
