import { APIResource } from "../../../core/resource.js";
import { APIPromise } from "../../../core/api-promise.js";
import { CursorLimitPagination, type CursorLimitPaginationParams, PagePromise } from "../../../core/pagination.js";
import { RequestOptions } from "../../../internal/request-options.js";
export declare class BaseScans extends APIResource {
    static readonly _key: readonly ['managedDefense', 'vulnerabilityDiscovery', 'scans'];
    /**
     * Submits repository intent for operator review. This endpoint does not
     * immediately start execution. Worker-imported repositories must be ready;
     * explicit `repo_hosts` must be authorized before the request is persisted.
     *
     * @example
     * ```ts
     * const scan =
     *   await client.managedDefense.vulnerabilityDiscovery.scans.create(
     *     {
     *       account_id: '023e105f4ecef8ad9ca31a8372d0c353',
     *       repos: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],
     *     },
     *   );
     * ```
     */
    create(params: ScanCreateParams, options?: RequestOptions): APIPromise<ScanCreateResponse>;
    /**
     * Lists customer-requested scans across review and execution lifecycle states.
     *
     * @example
     * ```ts
     * // Automatically fetches more pages as needed.
     * for await (const scanListResponse of client.managedDefense.vulnerabilityDiscovery.scans.list(
     *   { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
     * )) {
     *   // ...
     * }
     * ```
     */
    list(params: ScanListParams, options?: RequestOptions): PagePromise<ScanListResponsesCursorLimitPagination, ScanListResponse>;
    /**
     * Gets one customer-requested scan across its review and execution lifecycle.
     *
     * @example
     * ```ts
     * const scan =
     *   await client.managedDefense.vulnerabilityDiscovery.scans.get(
     *     '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
     *     { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
     *   );
     * ```
     */
    get(scanID: string, params: ScanGetParams, options?: RequestOptions): APIPromise<ScanGetResponse>;
    /**
     * Gets the active operator-reviewed scan report. Repository metadata records
     * report readiness even when no publication is available.
     *
     * @example
     * ```ts
     * const response =
     *   await client.managedDefense.vulnerabilityDiscovery.scans.getReport(
     *     '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
     *     { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
     *   );
     * ```
     */
    getReport(scanID: string, params: ScanGetReportParams, options?: RequestOptions): APIPromise<ScanGetReportResponse>;
}
export declare class Scans extends BaseScans {
}
export type ScanListResponsesCursorLimitPagination = CursorLimitPagination<ScanListResponse>;
export interface ScanCreateResponse {
    id: string;
    completed_at: string | null;
    message: string | null;
    phase: 'provisioning' | 'indexing' | 'analyzing' | 'reporting' | 'finalizing' | null;
    repositories: Array<ScanCreateResponse.Repository>;
    started_at: string | null;
    status: 'requested' | 'accepted' | 'running' | 'completed' | 'failed' | 'rejected' | 'cancelled';
    submitted_at: string;
    /**
     * UTC ISO-8601 interval. Start is inclusive, end is exclusive, and the interval
     * must be positive and at most seven days.
     */
    telemetry_window?: ScanCreateResponse.TelemetryWindow;
}
export declare namespace ScanCreateResponse {
    interface Repository {
        id: string;
        name: string;
        phase: 'provisioning' | 'indexing' | 'analyzing' | 'reporting' | 'finalizing' | null;
        report_status: 'not_ready' | 'pending_review' | 'published' | 'withdrawn';
        status: 'requested' | 'accepted' | 'running' | 'completed' | 'failed' | 'rejected' | 'cancelled';
    }
    /**
     * UTC ISO-8601 interval. Start is inclusive, end is exclusive, and the interval
     * must be positive and at most seven days.
     */
    interface TelemetryWindow {
        end: string;
        start: string;
    }
}
export interface ScanListResponse {
    id: string;
    completed_at: string | null;
    message: string | null;
    phase: 'provisioning' | 'indexing' | 'analyzing' | 'reporting' | 'finalizing' | null;
    repositories: Array<ScanListResponse.Repository>;
    started_at: string | null;
    status: 'requested' | 'accepted' | 'running' | 'completed' | 'failed' | 'rejected' | 'cancelled';
    submitted_at: string;
    /**
     * UTC ISO-8601 interval. Start is inclusive, end is exclusive, and the interval
     * must be positive and at most seven days.
     */
    telemetry_window?: ScanListResponse.TelemetryWindow;
}
export declare namespace ScanListResponse {
    interface Repository {
        id: string;
        name: string;
        phase: 'provisioning' | 'indexing' | 'analyzing' | 'reporting' | 'finalizing' | null;
        report_status: 'not_ready' | 'pending_review' | 'published' | 'withdrawn';
        status: 'requested' | 'accepted' | 'running' | 'completed' | 'failed' | 'rejected' | 'cancelled';
    }
    /**
     * UTC ISO-8601 interval. Start is inclusive, end is exclusive, and the interval
     * must be positive and at most seven days.
     */
    interface TelemetryWindow {
        end: string;
        start: string;
    }
}
export interface ScanGetResponse {
    id: string;
    completed_at: string | null;
    message: string | null;
    phase: 'provisioning' | 'indexing' | 'analyzing' | 'reporting' | 'finalizing' | null;
    repositories: Array<ScanGetResponse.Repository>;
    started_at: string | null;
    status: 'requested' | 'accepted' | 'running' | 'completed' | 'failed' | 'rejected' | 'cancelled';
    submitted_at: string;
    /**
     * UTC ISO-8601 interval. Start is inclusive, end is exclusive, and the interval
     * must be positive and at most seven days.
     */
    telemetry_window?: ScanGetResponse.TelemetryWindow;
}
export declare namespace ScanGetResponse {
    interface Repository {
        id: string;
        name: string;
        phase: 'provisioning' | 'indexing' | 'analyzing' | 'reporting' | 'finalizing' | null;
        report_status: 'not_ready' | 'pending_review' | 'published' | 'withdrawn';
        status: 'requested' | 'accepted' | 'running' | 'completed' | 'failed' | 'rejected' | 'cancelled';
    }
    /**
     * UTC ISO-8601 interval. Start is inclusive, end is exclusive, and the interval
     * must be positive and at most seven days.
     */
    interface TelemetryWindow {
        end: string;
        start: string;
    }
}
export interface ScanGetReportResponse {
    publication: ScanGetReportResponse.Publication | null;
    report: ScanGetReportResponse.Report | null;
    repositories: Array<ScanGetReportResponse.Repository>;
    scan_id: string;
}
export declare namespace ScanGetReportResponse {
    interface Publication {
        published_at: string;
        revision_id: string;
        version: number;
    }
    interface Report {
        executive_summary: string;
        /**
         * Revision requests must echo the existing generation timestamp unchanged.
         */
        generated_at: string;
        overall_severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
        repositories: Array<Report.Repository>;
        schema_version: 2;
        title: string;
    }
    namespace Report {
        interface Repository {
            findings: Array<Repository.Finding>;
            overall_severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
            repository_id: string;
            repository_name: string;
            summary: string;
            traffic_context: Repository.TrafficContext;
            external_links?: Array<Repository.ExternalLink>;
            limitations?: Array<string>;
        }
        namespace Repository {
            interface Finding {
                id: string;
                conditions: Array<string>;
                cwe: string;
                impact: string;
                location: Finding.Location;
                reachability: Array<Finding.Reachability>;
                remediation: Finding.Remediation;
                root_cause: string;
                severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
                severity_basis: string;
                summary: string;
                telemetry: Finding.Telemetry;
                title: string;
                trace: Array<Finding.Trace>;
                waf_rules: Finding.WAFRules | null;
                /**
                 * Least-privileged position required to trigger the finding. Optional on legacy
                 * report revisions.
                 */
                attacker_position?: 'external' | 'authenticated' | 'internal' | 'post_compromise' | null;
                external_links?: Array<Finding.ExternalLink>;
                /**
                 * One bounded unresolved proof question. Optional on legacy report revisions.
                 */
                open_question?: string | null;
                /**
                 * Method used or needed to close the proof. Optional on legacy report revisions.
                 */
                proof_method?: 'structural' | 'experimental' | 'acquired_source' | 'public_knowledge' | 'team_question' | null;
                /**
                 * Current proof lifecycle state. Optional on legacy report revisions.
                 */
                proof_state?: 'closed' | 'pending_source' | 'pending_public' | 'pending_experiment' | 'pending_team' | null;
            }
            namespace Finding {
                interface Location {
                    file: string;
                    line: number;
                    route: string | null;
                }
                interface Reachability {
                    consumer: string;
                    reachable: boolean;
                    via: string;
                }
                interface Remediation {
                    code_changes: string | null;
                    strategy: string;
                }
                interface Telemetry {
                    references: Array<string>;
                    state: 'no_route' | 'no_telemetry' | 'no_match' | 'matched';
                }
                interface Trace {
                    line: number;
                    path: string;
                    scope: string;
                    why: string;
                }
                interface WAFRules {
                    broad: WAFRules.Broad | null;
                    targeted: WAFRules.Targeted | null;
                }
                namespace WAFRules {
                    interface Broad {
                        action: 'block' | 'managed_challenge' | 'js_challenge' | 'log';
                        confidence: 'low' | 'medium' | 'high';
                        description: string;
                        expression: string;
                        false_positive_risk: string;
                        name: string;
                        rationale: string;
                    }
                    interface Targeted {
                        action: 'block' | 'managed_challenge' | 'js_challenge' | 'log';
                        confidence: 'low' | 'medium' | 'high';
                        description: string;
                        expression: string;
                        false_positive_risk: string;
                        name: string;
                        rationale: string;
                    }
                }
                interface ExternalLink {
                    title: string;
                    url: string;
                }
            }
            interface TrafficContext {
                http: TrafficContext.HTTP | null;
                target: TrafficContext.Target | null;
                waf: TrafficContext.WAF | null;
                web_assets: TrafficContext.WebAssets | null;
            }
            namespace TrafficContext {
                interface HTTP {
                    error_paths: Array<HTTP.ErrorPath>;
                    hot_paths: Array<HTTP.HotPath>;
                    request_volume: number;
                }
                namespace HTTP {
                    interface ErrorPath {
                        id: string;
                        hits: number;
                        host: string;
                        path: string;
                        status: number;
                    }
                    interface HotPath {
                        id: string;
                        hits: number;
                        host: string;
                        path: string;
                        top_status: number;
                    }
                }
                interface Target {
                    hosts: Array<string>;
                    kind: 'worker' | 'origin';
                    /**
                     * UTC ISO-8601 interval. Start is inclusive, end is exclusive, and the interval
                     * must be positive and at most seven days.
                     */
                    telemetry_window?: Target.TelemetryWindow;
                }
                namespace Target {
                    /**
                     * UTC ISO-8601 interval. Start is inclusive, end is exclusive, and the interval
                     * must be positive and at most seven days.
                     */
                    interface TelemetryWindow {
                        end: string;
                        start: string;
                    }
                }
                interface WAF {
                    hit_volume: number;
                    rules: Array<WAF.Rule>;
                }
                namespace WAF {
                    interface Rule {
                        id: string;
                        hit_volume: number;
                        paths: Array<Rule.Path>;
                        rule_id: string;
                        rule_version: number | null;
                    }
                    namespace Rule {
                        interface Path {
                            id: string;
                            hit_volume: number;
                            host: string;
                            path: string;
                        }
                    }
                }
                interface WebAssets {
                    operations: Array<WebAssets.Operation>;
                    paths: Array<WebAssets.Path>;
                    risk_types: Array<WebAssets.RiskType>;
                }
                namespace WebAssets {
                    interface Operation {
                        id: string;
                        endpoint: string;
                        host: string;
                        method: string;
                        risk_labels: Array<Operation.RiskLabel>;
                        performance?: Operation.Performance;
                    }
                    namespace Operation {
                        interface RiskLabel {
                            description: string | null;
                            name: string;
                        }
                        interface Performance {
                            avg_origin_latency_ms: number | null;
                            error_rate: number;
                            estimated_requests: number;
                        }
                    }
                    interface Path {
                        id: string;
                        avg_origin_latency_ms: number | null;
                        error_rate: number;
                        estimated_requests: number;
                        host: string;
                        path: string;
                    }
                    interface RiskType {
                        description: string | null;
                        name: string;
                        operation_count: number;
                    }
                }
            }
            interface ExternalLink {
                title: string;
                url: string;
            }
        }
    }
    interface Repository {
        id: string;
        name: string;
        report_status: 'not_ready' | 'pending_review' | 'published' | 'withdrawn';
        scan_status: 'requested' | 'accepted' | 'running' | 'completed' | 'failed' | 'rejected' | 'cancelled';
    }
}
export interface ScanCreateParams {
    /**
     * Path param
     */
    account_id: string;
    /**
     * Body param
     */
    repos: Array<string>;
    /**
     * Body param: Explicit hostname scopes. Every hostname must be authorized for its
     * repository before review admission; rejected scopes return 422 and do not
     * persist a scan request.
     */
    repo_hosts?: {
        [key: string]: Array<string>;
    };
    /**
     * Body param: UTC ISO-8601 interval. Start is inclusive, end is exclusive, and the
     * interval must be positive and at most seven days.
     */
    telemetry_window?: ScanCreateParams.TelemetryWindow;
    /**
     * Header param: Optional. Supply this header to safely retry a request. Required
     * when `worker_script_name` is supplied.
     */
    'Idempotency-Key'?: string;
}
export declare namespace ScanCreateParams {
    /**
     * UTC ISO-8601 interval. Start is inclusive, end is exclusive, and the interval
     * must be positive and at most seven days.
     */
    interface TelemetryWindow {
        end: string;
        start: string;
    }
}
export interface ScanListParams extends CursorLimitPaginationParams {
    /**
     * Path param
     */
    account_id: string;
    /**
     * Query param
     */
    repo?: string;
    /**
     * Query param: Repeat parameter or provide comma-separated values.
     */
    status?: 'requested' | 'accepted' | 'running' | 'completed' | 'failed' | 'rejected' | 'cancelled' | Array<'requested' | 'accepted' | 'running' | 'completed' | 'failed' | 'rejected' | 'cancelled'>;
}
export interface ScanGetParams {
    account_id: string;
}
export interface ScanGetReportParams {
    account_id: string;
}
export declare namespace Scans {
    export { type ScanCreateResponse as ScanCreateResponse, type ScanListResponse as ScanListResponse, type ScanGetResponse as ScanGetResponse, type ScanGetReportResponse as ScanGetReportResponse, type ScanListResponsesCursorLimitPagination as ScanListResponsesCursorLimitPagination, type ScanCreateParams as ScanCreateParams, type ScanListParams as ScanListParams, type ScanGetParams as ScanGetParams, type ScanGetReportParams as ScanGetReportParams, };
}
//# sourceMappingURL=scans.d.ts.map