// File generated from our OpenAPI spec by Stainless.

import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import * as ReferencesAPI from 'cloudflare/resources/users/load-balancers/monitors/references';

export class References extends APIResource {
  /**
   * Get the list of resources that reference the provided monitor.
   */
  loadBalancerMonitorsListMonitorReferences(
    monitorId: string,
    options?: Core.RequestOptions,
  ): Core.APIPromise<ReferenceLoadBalancerMonitorsListMonitorReferencesResponse | null> {
    return (
      this._client.get(`/user/load_balancers/monitors/${monitorId}/references`, options) as Core.APIPromise<{
        result: ReferenceLoadBalancerMonitorsListMonitorReferencesResponse | null;
      }>
    )._thenUnwrap((obj) => obj.result);
  }
}

/**
 * List of resources that reference a given monitor.
 */
export type ReferenceLoadBalancerMonitorsListMonitorReferencesResponse =
  Array<ReferenceLoadBalancerMonitorsListMonitorReferencesResponse.ReferenceLoadBalancerMonitorsListMonitorReferencesResponseItem>;

export namespace ReferenceLoadBalancerMonitorsListMonitorReferencesResponse {
  export interface ReferenceLoadBalancerMonitorsListMonitorReferencesResponseItem {
    reference_type?: '*' | 'referral' | 'referrer';

    resource_id?: string;

    resource_name?: string;

    resource_type?: string;
  }
}

export namespace References {
  export import ReferenceLoadBalancerMonitorsListMonitorReferencesResponse = ReferencesAPI.ReferenceLoadBalancerMonitorsListMonitorReferencesResponse;
}
