// Example Jenkinsfile for an application repo (Python/Java/Angular/React — anything).
// Requires:
//   1. The argus-shared-library registered in Jenkins (see jenkins/README.md).
//   2. This job configured as a Multibranch Pipeline with Bitbucket branch source +
//      "Discover pull requests" enabled, so env.CHANGE_URL is populated on PR builds.
//   3. Three Jenkins credentials created (see jenkins/README.md for exact types):
//      argus-bitbucket-token, argus-llm-gateway, and (Bitbucket Cloud + API-token only)
//      argus-bitbucket-email.

@Library('argus-shared-library') _

pipeline {
    agent any
    stages {
        stage('Checkout') {
            steps { checkout scm }
        }

        stage('AI Code Review') {
            when { changeRequest() }   // only run against pull requests
            steps {
                argusReview(
                    image: 'registry.internal/argus-review:0.1.0',
                    model: 'openai/gpt-4.1-mini',
                    // failOn: 'never',   // report-only for now; tighten once signal looks good
                    // bitbucketEmailCredentialsId: 'argus-bitbucket-email',   // Cloud + API token only
                )
            }
        }

        // ... your existing build/test stages, unchanged ...
    }
}
