/**
 * @deprecated Legacy audit run details. Use OCSFAuditEvent instead.
 */

import { ApiLocationContext } from '../api/index.js';
import { AuditLogDetails } from './audit.js';

/** @deprecated Use OCSFAuditEvent instead. */
interface ApiRunDetails extends AuditLogDetails {
  target: string;
  locationContext?: ApiLocationContext;
  endTime?: Date;
  status?: ApiRunStatus;
  error?: string;
}

/** @deprecated Use OCSFStatusId instead. */
export enum ApiRunStatus {
  SUCCESS,
  FAIL
}

/** @deprecated Use OCSFAuditEvent type checking instead. */
export function isApiRunDetails(details: AuditLogDetails | undefined): details is ApiRunDetails {
  if (!details) {
    return false;
  }
  return 'target' in details;
}
