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

import { APIResource } from '../../../core/resource';
import { APIPromise } from '../../../core/api-promise';
import { RequestOptions } from '../../../internal/request-options';
import { path } from '../../../internal/utils/path';

export class BaseRaw extends APIResource {
  static override readonly _key: readonly ['cloudforceOne', 'threatEvents', 'raw'] = Object.freeze([
    'cloudforceOne',
    'threatEvents',
    'raw',
  ] as const);

  /**
   * Partially updates raw threat event data in Cloudforce One, modifying specific
   * fields of the event.
   *
   * @example
   * ```ts
   * const response =
   *   await client.cloudforceOne.threatEvents.raw.edit(
   *     'raw_id',
   *     { account_id: 'account_id', event_id: 'event_id' },
   *   );
   * ```
   */
  edit(rawID: string, params: RawEditParams, options?: RequestOptions): APIPromise<RawEditResponse> {
    const { account_id, event_id, ...body } = params;
    return this._client.patch(path`/accounts/${account_id}/cloudforce-one/events/${event_id}/raw/${rawID}`, {
      body,
      ...options,
    });
  }

  /**
   * Retrieves raw threat event data for a specific event in Cloudforce One.
   *
   * @example
   * ```ts
   * const raw = await client.cloudforceOne.threatEvents.raw.get(
   *   'raw_id',
   *   { account_id: 'account_id', event_id: 'event_id' },
   * );
   * ```
   */
  get(rawID: string, params: RawGetParams, options?: RequestOptions): APIPromise<RawGetResponse> {
    const { account_id, event_id } = params;
    return this._client.get(
      path`/accounts/${account_id}/cloudforce-one/events/${event_id}/raw/${rawID}`,
      options,
    );
  }
}
export class Raw extends BaseRaw {}

export interface RawEditResponse {
  id: string;

  data: unknown;
}

export interface RawGetResponse {
  id: string;

  accountId: number;

  created: string;

  data: unknown;

  source: string;

  tlp: string;
}

export interface RawEditParams {
  /**
   * Path param: Account ID.
   */
  account_id: string;

  /**
   * Path param: Event UUID.
   */
  event_id: string;

  /**
   * Body param
   */
  data?: unknown;

  /**
   * Body param
   */
  source?: string;

  /**
   * Body param
   */
  tlp?: string;
}

export interface RawGetParams {
  /**
   * Account ID.
   */
  account_id: string;

  /**
   * Event UUID.
   */
  event_id: string;
}

export declare namespace Raw {
  export {
    type RawEditResponse as RawEditResponse,
    type RawGetResponse as RawGetResponse,
    type RawEditParams as RawEditParams,
    type RawGetParams as RawGetParams,
  };
}
