/**
 * Settings data shapes for Onebox
 */

export type TDcRouterMode = 'managed' | 'external' | 'disabled';
export type TStorageTargetKind = 'local' | 'nfs' | 'smb' | 'backup' | 'custom';
export type TStorageClassPurpose = 'runtime' | 'database' | 'backup';

export interface IStorageTargetConfig {
  path?: string;
  server?: string;
  exportPath?: string;
  share?: string;
  username?: string;
  password?: string;
  domain?: string;
  version?: string;
  driver?: string;
  device?: string;
  options?: Record<string, string>;
}

export interface IStorageTarget {
  id?: number;
  name: string;
  displayName: string;
  kind: TStorageTargetKind;
  config: IStorageTargetConfig;
  createdAt: number;
  updatedAt: number;
}

export interface IStorageClass {
  id?: number;
  name: string;
  displayName: string;
  description?: string;
  targetName: string;
  purpose: TStorageClassPurpose;
  isDefault?: boolean;
  driver?: string;
  options?: Record<string, string>;
  createdAt: number;
  updatedAt: number;
}

export interface IManagedDcRouterStatus {
  mode: TDcRouterMode;
  configured: boolean;
  running: boolean;
  healthy: boolean;
  containerId?: string;
  image: string;
  gatewayUrl: string;
  opsPort: number;
  httpPort: number;
  httpsPort: number;
  message?: string;
}

export interface ISettings {
  cloudflareToken: string;
  cloudflareZoneId: string;
  adminUiDomain: string;
  dcrouterMode: TDcRouterMode;
  dcrouterManagedImage: string;
  dcrouterManagedOpsPort: number;
  dcrouterManagedHttpPort: number;
  dcrouterManagedHttpsPort: number;
  dcrouterManagedDataDir: string;
  dcrouterGatewayUrl: string;
  dcrouterGatewayApiToken: string;
  dcrouterGatewayClientId: string;
  /** @deprecated Use dcrouterGatewayClientId. */
  dcrouterTargetHost: string;
  dcrouterTargetPort: number;
  platformStorageClass: string;
  autoRenewCerts: boolean;
  renewalThreshold: number;
  acmeEmail: string;
  httpPort: number;
  httpsPort: number;
  forceHttps: boolean;
}
