import { Metadata } from './base-asset.model.js';

//TODO: Move this to @apic/api-model package
export interface DataPowerAssembly {
  kind?: string | undefined;
  metadata?: Metadata | undefined;
  spec?: DataPowerAssemblyDocument | any;
  apiVersion?: string | undefined;
}

interface ExecuteItem {
  [key: string]: {
    title?: string;
    version?: string;
  };
}

interface Assembly {
  execute?: ExecuteItem[];
}

// interface Config {
//   assembly?: Assembly
// }

// interface Spec {
//   'x-ibm-configuration' ?: Config
// }

export type AdditionalSettingsCatalogPropertyMap = Record<
  string,
  { properties: Record<string, string> }
>;

export interface DataPowerAssemblyDocument {
  'x-ibm-configuration': {
    gateway?: string;
    enforced?: boolean;
    testable?: boolean;
    phase?: 'specified' | 'identified' | 'realized';
    assembly?: Assembly;
    'activity-log'?: {
      enabled: boolean;
      'success-content': string;
      'error-content': string;
      'preserved-request-header'?: string[];
      'preserved-response-header'?: string[];
    };
    'application-authentication'?: {
      certificate: boolean;
    };
    'application-authentication-source'?: string[];
    catalogs?: AdditionalSettingsCatalogPropertyMap;
  };
}
