// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../../core/resource';
import * as AuthoritiesAPI from './authorities';
import {
  Authorities,
  AuthorityGetParams,
  AuthorityGetResponse,
  AuthorityListParams,
  AuthorityListResponse,
  BaseAuthorities,
} from './authorities';
import * as LogsAPI from './logs';
import { BaseLogs, LogGetParams, LogGetResponse, LogListParams, LogListResponse, Logs } from './logs';
import { APIPromise } from '../../../core/api-promise';
import { RequestOptions } from '../../../internal/request-options';
import { path } from '../../../internal/utils/path';

export class BaseCT extends APIResource {
  static override readonly _key: readonly ['radar', 'ct'] = Object.freeze(['radar', 'ct'] as const);

  /**
   * Retrieves an aggregated summary of certificates grouped by the specified
   * dimension.
   *
   * @example
   * ```ts
   * const response = await client.radar.ct.summary('CA');
   * ```
   */
  summary(
    dimension:
      | 'CA'
      | 'CA_OWNER'
      | 'DURATION'
      | 'ENTRY_TYPE'
      | 'EXPIRATION_STATUS'
      | 'HAS_IPS'
      | 'HAS_WILDCARDS'
      | 'LOG'
      | 'LOG_API'
      | 'LOG_OPERATOR'
      | 'PUBLIC_KEY_ALGORITHM'
      | 'SIGNATURE_ALGORITHM'
      | 'TLD'
      | 'VALIDATION_LEVEL',
    query: CTSummaryParams | null | undefined = {},
    options?: RequestOptions,
  ): APIPromise<CTSummaryResponse> {
    return (
      this._client.get(path`/radar/ct/summary/${dimension}`, { query, ...options }) as APIPromise<{
        result: CTSummaryResponse;
      }>
    )._thenUnwrap((obj) => obj.result);
  }

  /**
   * Retrieves certificate volume over time.
   *
   * @example
   * ```ts
   * const response = await client.radar.ct.timeseries();
   * ```
   */
  timeseries(
    query: CTTimeseriesParams | null | undefined = {},
    options?: RequestOptions,
  ): APIPromise<CTTimeseriesResponse> {
    return (
      this._client.get('/radar/ct/timeseries', { query, ...options }) as APIPromise<{
        result: CTTimeseriesResponse;
      }>
    )._thenUnwrap((obj) => obj.result);
  }

  /**
   * Retrieves the distribution of certificates grouped by the specified dimension
   * over time.
   *
   * @example
   * ```ts
   * const response = await client.radar.ct.timeseriesGroups(
   *   'CA',
   * );
   * ```
   */
  timeseriesGroups(
    dimension:
      | 'CA'
      | 'CA_OWNER'
      | 'DURATION'
      | 'ENTRY_TYPE'
      | 'EXPIRATION_STATUS'
      | 'HAS_IPS'
      | 'HAS_WILDCARDS'
      | 'LOG'
      | 'LOG_API'
      | 'LOG_OPERATOR'
      | 'PUBLIC_KEY_ALGORITHM'
      | 'SIGNATURE_ALGORITHM'
      | 'TLD'
      | 'VALIDATION_LEVEL',
    query: CTTimeseriesGroupsParams | null | undefined = {},
    options?: RequestOptions,
  ): APIPromise<CTTimeseriesGroupsResponse> {
    return (
      this._client.get(path`/radar/ct/timeseries_groups/${dimension}`, { query, ...options }) as APIPromise<{
        result: CTTimeseriesGroupsResponse;
      }>
    )._thenUnwrap((obj) => obj.result);
  }
}
export class CT extends BaseCT {
  authorities: AuthoritiesAPI.Authorities = new AuthoritiesAPI.Authorities(this._client);
  logs: LogsAPI.Logs = new LogsAPI.Logs(this._client);
}

export interface CTSummaryResponse {
  /**
   * Metadata for the results.
   */
  meta: CTSummaryResponse.Meta;

  summary_0:
    | { [key: string]: string }
    | CTSummaryResponse.UnionMember1
    | CTSummaryResponse.UnionMember2
    | CTSummaryResponse.UnionMember3
    | CTSummaryResponse.UnionMember4
    | CTSummaryResponse.UnionMember5
    | CTSummaryResponse.UnionMember6
    | CTSummaryResponse.UnionMember7;
}

export namespace CTSummaryResponse {
  /**
   * Metadata for the results.
   */
  export interface Meta {
    confidenceInfo: Meta.ConfidenceInfo;

    dateRange: Array<Meta.DateRange>;

    /**
     * Timestamp of the last dataset update.
     */
    lastUpdated: string;

    /**
     * Normalization method applied to the results. Refer to
     * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/).
     */
    normalization:
      | 'PERCENTAGE'
      | 'MIN0_MAX'
      | 'MIN_MAX'
      | 'RAW_VALUES'
      | 'PERCENTAGE_CHANGE'
      | 'ROLLING_AVERAGE'
      | 'OVERLAPPED_PERCENTAGE'
      | 'RATIO';

    /**
     * Measurement units for the results.
     */
    units: Array<Meta.Unit>;
  }

  export namespace Meta {
    export interface ConfidenceInfo {
      annotations: Array<ConfidenceInfo.Annotation>;

      /**
       * Provides an indication of how much confidence Cloudflare has in the data.
       */
      level: number;
    }

    export namespace ConfidenceInfo {
      /**
       * Annotation associated with the result (e.g. outage or other type of event).
       */
      export interface Annotation {
        /**
         * Data source for annotations.
         */
        dataSource:
          | 'ALL'
          | 'AI_BOTS'
          | 'AI_GATEWAY'
          | 'BGP'
          | 'BOTS'
          | 'CONNECTION_ANOMALY'
          | 'CT'
          | 'DNS'
          | 'DNS_MAGNITUDE'
          | 'DNS_AS112'
          | 'DOS'
          | 'EMAIL_ROUTING'
          | 'EMAIL_SECURITY'
          | 'FW'
          | 'FW_PG'
          | 'HTTP'
          | 'HTTP_CONTROL'
          | 'HTTP_CRAWLER_REFERER'
          | 'HTTP_ORIGINS'
          | 'IQI'
          | 'LEAKED_CREDENTIALS'
          | 'NET'
          | 'ROBOTS_TXT'
          | 'SPEED'
          | 'WORKERS_AI';

        description: string;

        endDate: string;

        /**
         * Event type for annotations.
         */
        eventType: 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY';

        /**
         * Whether event is a single point in time or a time range.
         */
        isInstantaneous: boolean;

        linkedUrl: string;

        startDate: string;

        tags?: Array<string>;
      }
    }

    export interface DateRange {
      /**
       * Adjusted end of date range.
       */
      endTime: string;

      /**
       * Adjusted start of date range.
       */
      startTime: string;
    }

    export interface Unit {
      name: string;

      value: string;
    }
  }

  export interface UnionMember1 {
    rfc6962: string;

    static: string;
  }

  export interface UnionMember2 {
    gt_121d: string;

    gt_16d_lte_31d: string;

    gt_31d_lte_91d: string;

    gt_3d_lte_16d: string;

    gt_91d_lte_121d: string;

    lte_3d: string;
  }

  export interface UnionMember3 {
    CERTIFICATE: string;

    PRECERTIFICATE: string;
  }

  export interface UnionMember4 {
    EXPIRED: string;

    VALID: string;
  }

  export interface UnionMember5 {
    NEGATIVE: string;

    POSITIVE: string;
  }

  export interface UnionMember6 {
    DSA: string;

    ECDSA: string;

    RSA: string;
  }

  export interface UnionMember7 {
    domain: string;

    extended: string;

    organization: string;

    unknown: string;
  }
}

export interface CTTimeseriesResponse {
  /**
   * Metadata for the results.
   */
  meta: CTTimeseriesResponse.Meta;

  [k: string]:
    | CTTimeseriesResponse.unnamed_schema_ref_75bae70cf28e6bcef364b9840db3bdeb
    | CTTimeseriesResponse.Meta
    | undefined;
}

export namespace CTTimeseriesResponse {
  /**
   * Metadata for the results.
   */
  export interface Meta {
    /**
     * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals).
     * Refer to
     * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/).
     */
    aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH';

    confidenceInfo: Meta.ConfidenceInfo;

    dateRange: Array<Meta.DateRange>;

    /**
     * Timestamp of the last dataset update.
     */
    lastUpdated: string;

    /**
     * Normalization method applied to the results. Refer to
     * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/).
     */
    normalization:
      | 'PERCENTAGE'
      | 'MIN0_MAX'
      | 'MIN_MAX'
      | 'RAW_VALUES'
      | 'PERCENTAGE_CHANGE'
      | 'ROLLING_AVERAGE'
      | 'OVERLAPPED_PERCENTAGE'
      | 'RATIO';

    /**
     * Measurement units for the results.
     */
    units: Array<Meta.Unit>;
  }

  export namespace Meta {
    export interface ConfidenceInfo {
      annotations: Array<ConfidenceInfo.Annotation>;

      /**
       * Provides an indication of how much confidence Cloudflare has in the data.
       */
      level: number;
    }

    export namespace ConfidenceInfo {
      /**
       * Annotation associated with the result (e.g. outage or other type of event).
       */
      export interface Annotation {
        /**
         * Data source for annotations.
         */
        dataSource:
          | 'ALL'
          | 'AI_BOTS'
          | 'AI_GATEWAY'
          | 'BGP'
          | 'BOTS'
          | 'CONNECTION_ANOMALY'
          | 'CT'
          | 'DNS'
          | 'DNS_MAGNITUDE'
          | 'DNS_AS112'
          | 'DOS'
          | 'EMAIL_ROUTING'
          | 'EMAIL_SECURITY'
          | 'FW'
          | 'FW_PG'
          | 'HTTP'
          | 'HTTP_CONTROL'
          | 'HTTP_CRAWLER_REFERER'
          | 'HTTP_ORIGINS'
          | 'IQI'
          | 'LEAKED_CREDENTIALS'
          | 'NET'
          | 'ROBOTS_TXT'
          | 'SPEED'
          | 'WORKERS_AI';

        description: string;

        endDate: string;

        /**
         * Event type for annotations.
         */
        eventType: 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY';

        /**
         * Whether event is a single point in time or a time range.
         */
        isInstantaneous: boolean;

        linkedUrl: string;

        startDate: string;

        tags?: Array<string>;
      }
    }

    export interface DateRange {
      /**
       * Adjusted end of date range.
       */
      endTime: string;

      /**
       * Adjusted start of date range.
       */
      startTime: string;
    }

    export interface Unit {
      name: string;

      value: string;
    }
  }

  export interface unnamed_schema_ref_75bae70cf28e6bcef364b9840db3bdeb {
    timestamps: Array<string>;

    values: Array<string>;
  }
}

export interface CTTimeseriesGroupsResponse {
  /**
   * Metadata for the results.
   */
  meta: CTTimeseriesGroupsResponse.Meta;

  serie_0:
    | CTTimeseriesGroupsResponse.UnnamedSchemaRef7826220e105d84352ba1108d9ed88e55
    | CTTimeseriesGroupsResponse.UnionMember1
    | CTTimeseriesGroupsResponse.UnionMember2
    | CTTimeseriesGroupsResponse.UnionMember3
    | CTTimeseriesGroupsResponse.UnionMember4
    | CTTimeseriesGroupsResponse.UnionMember5
    | CTTimeseriesGroupsResponse.UnionMember6
    | CTTimeseriesGroupsResponse.UnionMember7;
}

export namespace CTTimeseriesGroupsResponse {
  /**
   * Metadata for the results.
   */
  export interface Meta {
    /**
     * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals).
     * Refer to
     * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/).
     */
    aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH';

    confidenceInfo: Meta.ConfidenceInfo;

    dateRange: Array<Meta.DateRange>;

    /**
     * Timestamp of the last dataset update.
     */
    lastUpdated: string;

    /**
     * Normalization method applied to the results. Refer to
     * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/).
     */
    normalization:
      | 'PERCENTAGE'
      | 'MIN0_MAX'
      | 'MIN_MAX'
      | 'RAW_VALUES'
      | 'PERCENTAGE_CHANGE'
      | 'ROLLING_AVERAGE'
      | 'OVERLAPPED_PERCENTAGE'
      | 'RATIO';

    /**
     * Measurement units for the results.
     */
    units: Array<Meta.Unit>;
  }

  export namespace Meta {
    export interface ConfidenceInfo {
      annotations: Array<ConfidenceInfo.Annotation>;

      /**
       * Provides an indication of how much confidence Cloudflare has in the data.
       */
      level: number;
    }

    export namespace ConfidenceInfo {
      /**
       * Annotation associated with the result (e.g. outage or other type of event).
       */
      export interface Annotation {
        /**
         * Data source for annotations.
         */
        dataSource:
          | 'ALL'
          | 'AI_BOTS'
          | 'AI_GATEWAY'
          | 'BGP'
          | 'BOTS'
          | 'CONNECTION_ANOMALY'
          | 'CT'
          | 'DNS'
          | 'DNS_MAGNITUDE'
          | 'DNS_AS112'
          | 'DOS'
          | 'EMAIL_ROUTING'
          | 'EMAIL_SECURITY'
          | 'FW'
          | 'FW_PG'
          | 'HTTP'
          | 'HTTP_CONTROL'
          | 'HTTP_CRAWLER_REFERER'
          | 'HTTP_ORIGINS'
          | 'IQI'
          | 'LEAKED_CREDENTIALS'
          | 'NET'
          | 'ROBOTS_TXT'
          | 'SPEED'
          | 'WORKERS_AI';

        description: string;

        endDate: string;

        /**
         * Event type for annotations.
         */
        eventType: 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY';

        /**
         * Whether event is a single point in time or a time range.
         */
        isInstantaneous: boolean;

        linkedUrl: string;

        startDate: string;

        tags?: Array<string>;
      }
    }

    export interface DateRange {
      /**
       * Adjusted end of date range.
       */
      endTime: string;

      /**
       * Adjusted start of date range.
       */
      startTime: string;
    }

    export interface Unit {
      name: string;

      value: string;
    }
  }

  export interface UnnamedSchemaRef7826220e105d84352ba1108d9ed88e55 {
    timestamps: Array<string>;

    [k: string]: Array<string> | Array<string> | undefined;
  }

  export interface UnionMember1 {
    rfc6962: Array<string>;

    static: Array<string>;
  }

  export interface UnionMember2 {
    gt_121d: Array<string>;

    gt_16d_lte_31d: Array<string>;

    gt_31d_lte_91d: Array<string>;

    gt_3d_lte_16d: Array<string>;

    gt_91d_lte_121d: Array<string>;

    lte_3d: Array<string>;
  }

  export interface UnionMember3 {
    CERTIFICATE: Array<string>;

    PRECERTIFICATE: Array<string>;
  }

  export interface UnionMember4 {
    EXPIRED: Array<string>;

    VALID: Array<string>;
  }

  export interface UnionMember5 {
    NEGATIVE: Array<string>;

    POSITIVE: Array<string>;
  }

  export interface UnionMember6 {
    DSA: Array<string>;

    ECDSA: Array<string>;

    RSA: Array<string>;
  }

  export interface UnionMember7 {
    domain: Array<string>;

    extended: Array<string>;

    organization: Array<string>;

    unknown: Array<string>;
  }
}

export interface CTSummaryParams {
  /**
   * Filters results by certificate authority.
   */
  ca?: Array<string>;

  /**
   * Filters results by certificate authority owner.
   */
  caOwner?: Array<string>;

  /**
   * End of the date range (inclusive). Alternative to `dateRange`; provide together
   * with `dateStart`. When requesting comparison series, every series must resolve
   * to the same duration as the main series. Each `dateStart`/`dateEnd` is floored
   * to the nearest 15 minutes before evaluation, so windows whose durations match
   * only before alignment may be rejected.
   */
  dateEnd?: Array<string>;

  /**
   * Filters results by relative date range ending at the current time, with each
   * value producing a separate series. Use `<n>d` for days (up to `364d`) or `<n>w`
   * for weeks (up to `52w`). Append `control` to request the equivalent previous
   * period for comparison: the comparison window is shifted back by the current
   * window's length rounded up to a whole number of weeks, so it keeps the same
   * weekday alignment and does not overlap the current window (e.g. `7dcontrol`
   * covers days -14 to -7, `10dcontrol` covers days -24 to -14). For example, pass
   * `7d` and `7dcontrol` to compare this week with the previous week. All series
   * must resolve to the same duration as the main series; relative ranges (including
   * `control`) satisfy this automatically. Use this parameter or set specific start
   * and end dates (`dateStart` and `dateEnd` parameters).
   */
  dateRange?: Array<string>;

  /**
   * Start of the date range. Alternative to `dateRange`; provide together with
   * `dateEnd`. When requesting comparison series, every series must resolve to the
   * same duration as the main series. Each `dateStart`/`dateEnd` is floored to the
   * nearest 15 minutes before evaluation, so windows whose durations match only
   * before alignment may be rejected.
   */
  dateStart?: Array<string>;

  /**
   * Filters results by certificate duration.
   */
  duration?: Array<
    | 'LTE_3D'
    | 'GT_3D_LTE_7D'
    | 'GT_7D_LTE_10D'
    | 'GT_10D_LTE_47D'
    | 'GT_47D_LTE_100D'
    | 'GT_100D_LTE_200D'
    | 'GT_200D'
  >;

  /**
   * Filters results by entry type (certificate vs. pre-certificate). Incompatible
   * with the `tld` filter/dimension.
   */
  entryType?: Array<'PRECERTIFICATE' | 'CERTIFICATE'>;

  /**
   * Filters results by expiration status (expired vs. valid).
   */
  expirationStatus?: Array<'EXPIRED' | 'VALID'>;

  /**
   * Format in which results will be returned.
   */
  format?: 'JSON' | 'CSV';

  /**
   * Filters results based on whether the certificates are bound to specific IP
   * addresses.
   */
  hasIps?: Array<boolean>;

  /**
   * Filters results based on whether the certificates contain wildcard domains.
   */
  hasWildcards?: Array<boolean>;

  /**
   * Limits the number of objects per group to the top items within the specified
   * time range. When item count exceeds the limit, extra items appear grouped under
   * an "other" category. Only supported on high-cardinality dimensions; otherwise
   * the request is rejected. Minimum value is 2.
   */
  limitPerGroup?: number;

  /**
   * Filters results by certificate log. Incompatible with the `tld`
   * filter/dimension.
   */
  log?: Array<string>;

  /**
   * Filters results by certificate log API (RFC6962 vs. static). Incompatible with
   * the `tld` filter/dimension.
   */
  logApi?: Array<'RFC6962' | 'STATIC'>;

  /**
   * Filters results by certificate log operator. Incompatible with the `tld`
   * filter/dimension.
   */
  logOperator?: Array<string>;

  /**
   * Array of names used to label the series in the response.
   */
  name?: Array<string>;

  /**
   * Normalization method applied to the results. Refer to
   * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/).
   */
  normalization?: 'RAW_VALUES' | 'PERCENTAGE';

  /**
   * Filters results by public key algorithm.
   */
  publicKeyAlgorithm?: Array<'DSA' | 'ECDSA' | 'RSA'>;

  /**
   * Filters results by signature algorithm.
   */
  signatureAlgorithm?: Array<
    | 'DSA_SHA_1'
    | 'DSA_SHA_256'
    | 'ECDSA_SHA_1'
    | 'ECDSA_SHA_256'
    | 'ECDSA_SHA_384'
    | 'ECDSA_SHA_512'
    | 'PSS_SHA_256'
    | 'PSS_SHA_384'
    | 'PSS_SHA_512'
    | 'RSA_MD2'
    | 'RSA_MD5'
    | 'RSA_SHA_1'
    | 'RSA_SHA_256'
    | 'RSA_SHA_384'
    | 'RSA_SHA_512'
  >;

  /**
   * Filters results by top-level domain. Incompatible with the `log`, `logApi`,
   * `logOperator`, and `entryType` filters/dimensions.
   */
  tld?: Array<string>;

  /**
   * Specifies whether to filter out duplicate certificates and pre-certificates. Set
   * to true for unique entries only.
   */
  uniqueEntries?: Array<'true' | 'false'>;

  /**
   * Filters results by validation level.
   */
  validationLevel?: Array<'DOMAIN' | 'ORGANIZATION' | 'EXTENDED'>;
}

export interface CTTimeseriesParams {
  /**
   * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals).
   * Refer to
   * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/).
   * When omitted, the interval is auto-selected from the requested date range; finer
   * intervals are only available for shorter ranges. If the requested interval is
   * too granular for the date range, the request is rejected.
   */
  aggInterval?: '15m' | '1h' | '1d' | '1w';

  /**
   * Filters results by certificate authority.
   */
  ca?: Array<string>;

  /**
   * Filters results by certificate authority owner.
   */
  caOwner?: Array<string>;

  /**
   * End of the date range (inclusive). Alternative to `dateRange`; provide together
   * with `dateStart`. When requesting comparison series, every series must resolve
   * to the same duration as the main series. Each `dateStart`/`dateEnd` is floored
   * to the nearest 15 minutes before evaluation, so windows whose durations match
   * only before alignment may be rejected.
   */
  dateEnd?: Array<string>;

  /**
   * Filters results by relative date range ending at the current time, with each
   * value producing a separate series. Use `<n>d` for days (up to `364d`) or `<n>w`
   * for weeks (up to `52w`). Append `control` to request the equivalent previous
   * period for comparison: the comparison window is shifted back by the current
   * window's length rounded up to a whole number of weeks, so it keeps the same
   * weekday alignment and does not overlap the current window (e.g. `7dcontrol`
   * covers days -14 to -7, `10dcontrol` covers days -24 to -14). For example, pass
   * `7d` and `7dcontrol` to compare this week with the previous week. All series
   * must resolve to the same duration as the main series; relative ranges (including
   * `control`) satisfy this automatically. Use this parameter or set specific start
   * and end dates (`dateStart` and `dateEnd` parameters).
   */
  dateRange?: Array<string>;

  /**
   * Start of the date range. Alternative to `dateRange`; provide together with
   * `dateEnd`. When requesting comparison series, every series must resolve to the
   * same duration as the main series. Each `dateStart`/`dateEnd` is floored to the
   * nearest 15 minutes before evaluation, so windows whose durations match only
   * before alignment may be rejected.
   */
  dateStart?: Array<string>;

  /**
   * Filters results by certificate duration.
   */
  duration?: Array<
    | 'LTE_3D'
    | 'GT_3D_LTE_7D'
    | 'GT_7D_LTE_10D'
    | 'GT_10D_LTE_47D'
    | 'GT_47D_LTE_100D'
    | 'GT_100D_LTE_200D'
    | 'GT_200D'
  >;

  /**
   * Filters results by entry type (certificate vs. pre-certificate). Incompatible
   * with the `tld` filter/dimension.
   */
  entryType?: Array<'PRECERTIFICATE' | 'CERTIFICATE'>;

  /**
   * Filters results by expiration status (expired vs. valid).
   */
  expirationStatus?: Array<'EXPIRED' | 'VALID'>;

  /**
   * Format in which results will be returned.
   */
  format?: 'JSON' | 'CSV';

  /**
   * Filters results based on whether the certificates are bound to specific IP
   * addresses.
   */
  hasIps?: Array<boolean>;

  /**
   * Filters results based on whether the certificates contain wildcard domains.
   */
  hasWildcards?: Array<boolean>;

  /**
   * Filters results by certificate log. Incompatible with the `tld`
   * filter/dimension.
   */
  log?: Array<string>;

  /**
   * Filters results by certificate log API (RFC6962 vs. static). Incompatible with
   * the `tld` filter/dimension.
   */
  logApi?: Array<'RFC6962' | 'STATIC'>;

  /**
   * Filters results by certificate log operator. Incompatible with the `tld`
   * filter/dimension.
   */
  logOperator?: Array<string>;

  /**
   * Array of names used to label the series in the response.
   */
  name?: Array<string>;

  /**
   * Filters results by public key algorithm.
   */
  publicKeyAlgorithm?: Array<'DSA' | 'ECDSA' | 'RSA'>;

  /**
   * Filters results by signature algorithm.
   */
  signatureAlgorithm?: Array<
    | 'DSA_SHA_1'
    | 'DSA_SHA_256'
    | 'ECDSA_SHA_1'
    | 'ECDSA_SHA_256'
    | 'ECDSA_SHA_384'
    | 'ECDSA_SHA_512'
    | 'PSS_SHA_256'
    | 'PSS_SHA_384'
    | 'PSS_SHA_512'
    | 'RSA_MD2'
    | 'RSA_MD5'
    | 'RSA_SHA_1'
    | 'RSA_SHA_256'
    | 'RSA_SHA_384'
    | 'RSA_SHA_512'
  >;

  /**
   * Filters results by top-level domain. Incompatible with the `log`, `logApi`,
   * `logOperator`, and `entryType` filters/dimensions.
   */
  tld?: Array<string>;

  /**
   * Specifies whether to filter out duplicate certificates and pre-certificates. Set
   * to true for unique entries only.
   */
  uniqueEntries?: Array<'true' | 'false'>;

  /**
   * Filters results by validation level.
   */
  validationLevel?: Array<'DOMAIN' | 'ORGANIZATION' | 'EXTENDED'>;
}

export interface CTTimeseriesGroupsParams {
  /**
   * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals).
   * Refer to
   * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/).
   * When omitted, the interval is auto-selected from the requested date range; finer
   * intervals are only available for shorter ranges. If the requested interval is
   * too granular for the date range, the request is rejected.
   */
  aggInterval?: '15m' | '1h' | '1d' | '1w';

  /**
   * Filters results by certificate authority.
   */
  ca?: Array<string>;

  /**
   * Filters results by certificate authority owner.
   */
  caOwner?: Array<string>;

  /**
   * End of the date range (inclusive). Alternative to `dateRange`; provide together
   * with `dateStart`. When requesting comparison series, every series must resolve
   * to the same duration as the main series. Each `dateStart`/`dateEnd` is floored
   * to the nearest 15 minutes before evaluation, so windows whose durations match
   * only before alignment may be rejected.
   */
  dateEnd?: Array<string>;

  /**
   * Filters results by relative date range ending at the current time, with each
   * value producing a separate series. Use `<n>d` for days (up to `364d`) or `<n>w`
   * for weeks (up to `52w`). Append `control` to request the equivalent previous
   * period for comparison: the comparison window is shifted back by the current
   * window's length rounded up to a whole number of weeks, so it keeps the same
   * weekday alignment and does not overlap the current window (e.g. `7dcontrol`
   * covers days -14 to -7, `10dcontrol` covers days -24 to -14). For example, pass
   * `7d` and `7dcontrol` to compare this week with the previous week. All series
   * must resolve to the same duration as the main series; relative ranges (including
   * `control`) satisfy this automatically. Use this parameter or set specific start
   * and end dates (`dateStart` and `dateEnd` parameters).
   */
  dateRange?: Array<string>;

  /**
   * Start of the date range. Alternative to `dateRange`; provide together with
   * `dateEnd`. When requesting comparison series, every series must resolve to the
   * same duration as the main series. Each `dateStart`/`dateEnd` is floored to the
   * nearest 15 minutes before evaluation, so windows whose durations match only
   * before alignment may be rejected.
   */
  dateStart?: Array<string>;

  /**
   * Filters results by certificate duration.
   */
  duration?: Array<
    | 'LTE_3D'
    | 'GT_3D_LTE_7D'
    | 'GT_7D_LTE_10D'
    | 'GT_10D_LTE_47D'
    | 'GT_47D_LTE_100D'
    | 'GT_100D_LTE_200D'
    | 'GT_200D'
  >;

  /**
   * Filters results by entry type (certificate vs. pre-certificate). Incompatible
   * with the `tld` filter/dimension.
   */
  entryType?: Array<'PRECERTIFICATE' | 'CERTIFICATE'>;

  /**
   * Filters results by expiration status (expired vs. valid).
   */
  expirationStatus?: Array<'EXPIRED' | 'VALID'>;

  /**
   * Format in which results will be returned.
   */
  format?: 'JSON' | 'CSV';

  /**
   * Filters results based on whether the certificates are bound to specific IP
   * addresses.
   */
  hasIps?: Array<boolean>;

  /**
   * Filters results based on whether the certificates contain wildcard domains.
   */
  hasWildcards?: Array<boolean>;

  /**
   * Limits the number of objects per group to the top items within the specified
   * time range. When item count exceeds the limit, extra items appear grouped under
   * an "other" category. Only supported on high-cardinality dimensions; otherwise
   * the request is rejected. Minimum value is 2.
   */
  limitPerGroup?: number;

  /**
   * Filters results by certificate log. Incompatible with the `tld`
   * filter/dimension.
   */
  log?: Array<string>;

  /**
   * Filters results by certificate log API (RFC6962 vs. static). Incompatible with
   * the `tld` filter/dimension.
   */
  logApi?: Array<'RFC6962' | 'STATIC'>;

  /**
   * Filters results by certificate log operator. Incompatible with the `tld`
   * filter/dimension.
   */
  logOperator?: Array<string>;

  /**
   * Array of names used to label the series in the response.
   */
  name?: Array<string>;

  /**
   * Normalization method applied to the results. Refer to
   * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/).
   */
  normalization?: 'RAW_VALUES' | 'PERCENTAGE';

  /**
   * Filters results by public key algorithm.
   */
  publicKeyAlgorithm?: Array<'DSA' | 'ECDSA' | 'RSA'>;

  /**
   * Filters results by signature algorithm.
   */
  signatureAlgorithm?: Array<
    | 'DSA_SHA_1'
    | 'DSA_SHA_256'
    | 'ECDSA_SHA_1'
    | 'ECDSA_SHA_256'
    | 'ECDSA_SHA_384'
    | 'ECDSA_SHA_512'
    | 'PSS_SHA_256'
    | 'PSS_SHA_384'
    | 'PSS_SHA_512'
    | 'RSA_MD2'
    | 'RSA_MD5'
    | 'RSA_SHA_1'
    | 'RSA_SHA_256'
    | 'RSA_SHA_384'
    | 'RSA_SHA_512'
  >;

  /**
   * Filters results by top-level domain. Incompatible with the `log`, `logApi`,
   * `logOperator`, and `entryType` filters/dimensions.
   */
  tld?: Array<string>;

  /**
   * Specifies whether to filter out duplicate certificates and pre-certificates. Set
   * to true for unique entries only.
   */
  uniqueEntries?: Array<'true' | 'false'>;

  /**
   * Filters results by validation level.
   */
  validationLevel?: Array<'DOMAIN' | 'ORGANIZATION' | 'EXTENDED'>;
}

CT.Authorities = Authorities;
CT.BaseAuthorities = BaseAuthorities;
CT.Logs = Logs;
CT.BaseLogs = BaseLogs;

export declare namespace CT {
  export {
    type CTSummaryResponse as CTSummaryResponse,
    type CTTimeseriesResponse as CTTimeseriesResponse,
    type CTTimeseriesGroupsResponse as CTTimeseriesGroupsResponse,
    type CTSummaryParams as CTSummaryParams,
    type CTTimeseriesParams as CTTimeseriesParams,
    type CTTimeseriesGroupsParams as CTTimeseriesGroupsParams,
  };

  export {
    Authorities as Authorities,
    BaseAuthorities as BaseAuthorities,
    type AuthorityListResponse as AuthorityListResponse,
    type AuthorityGetResponse as AuthorityGetResponse,
    type AuthorityListParams as AuthorityListParams,
    type AuthorityGetParams as AuthorityGetParams,
  };

  export {
    Logs as Logs,
    BaseLogs as BaseLogs,
    type LogListResponse as LogListResponse,
    type LogGetResponse as LogGetResponse,
    type LogListParams as LogListParams,
    type LogGetParams as LogGetParams,
  };
}
