// src/types.ts
// Copyright (C) 2026 Rob Colbert <rob.colbert@openplatform.us>
// Licensed under the Apache License, Version 2.0

/**
 * Gadget Code Web Server Configuration
 */
export interface GadgetCodeConfig {
  timezone?: string;
  site?: {
    company?: string;
    companyShort?: string;
    name?: string;
    shortName?: string;
    slogan?: string;
    description?: string;
    domain?: string;
    domainKey?: string;
    host?: string;
  };
  auth: {
    jwtSecret: string;
    passwordSalt: string;
  };
  session: {
    secret: string;
    trustProxy?: boolean;
    cookie: {
      secure?: boolean;
      sameSite?: boolean | "lax" | "strict" | "none";
    };
  };
  google: {
    cse: {
      apiKey: string;
      engineId: string;
    };
  };
  mongodb: {
    host: string;
    database: string;
  };
  redis: {
    host?: string;
    port?: number;
    password?: string;
    keyPrefix?: string;
    lazyConnect?: boolean;
  };
  https: {
    enabled?: boolean;
    address?: string;
    port?: number;
    backlog?: number;
    keyFile?: string;
    crtFile?: string;
    uploadPath?: string;
  };
  socket?: {
    maxHttpBufferSize?: number;
  };
  logging?: {
    console?: {
      enabled?: boolean;
    };
    file?: {
      enabled?: boolean;
      path?: string;
      name?: string;
      maxWritesPerFile?: number;
      maxFiles?: number;
    };
    https?: {
      enabled?: boolean;
      name?: string;
      path?: string;
      format?: string;
    };
    levels?: {
      debug?: boolean;
      info?: boolean;
      warn?: boolean;
    };
  };
  email?: {
    enabled?: boolean;
    smtp?: {
      host?: string;
      port?: number;
      secure?: boolean;
      from?: string;
      user?: string;
      password?: string;
      pool?: {
        enabled?: boolean;
        maxConnections?: number;
        maxMessages?: number;
      };
    };
    contact?: {
      to?: string;
    };
  };
  minio?: {
    endpoint?: string;
    port?: number;
    useSsl?: boolean;
    accessKey?: string;
    secretKey?: string;
    buckets?: {
      uploads?: string;
      images?: string;
      videos?: string;
      audios?: string;
    };
  };
 }

/**
 * Gadget Drone Worker Configuration
 */
export interface GadgetDroneConfig {
  timezone?: string;
  platform: {
    baseUrl: string;
    gadgetKey: string;
  };
  google?: {
    cse?: {
      apiKey: string;
      engineId: string;
    };
  };
  logging?: {
    console?: {
      enabled?: boolean;
    };
    file?: {
      enabled?: boolean;
      path?: string;
      name?: string;
      maxWritesPerFile?: number;
      maxFiles?: number;
    };
    levels?: {
      debug?: boolean;
      info?: boolean;
      warn?: boolean;
    };
  };
}

/**
 * Configuration search result
 */
export interface ConfigSearchResult {
  path: string;
  exists: boolean;
}
