export const BUILD_CONFIG = {
  // Target apps
  TARGET_APPS: {
    WEBCHAT: 'webchat',
    WEBVIEWS: 'webviews',
    NODE: 'node',
  } as const,

  // Input paths (source)
  INPUT: {
    webchat: {
      root: 'src/client/webchat',
      html: 'src/client/webchat/index.html',
      entry: 'src/client/webchat/index.tsx',
    },
    webviews: {
      root: 'src/client/webviews',
      html: 'src/client/webviews/index.html',
      entry: 'src/client/webviews/index.tsx',
    },
    node: {
      root: 'src/server',
      entry: 'src/server/bot/index.ts',
    },
  } as const,

  // Output paths (build artifacts)
  OUTPUT: {
    webchat: {
      dir: 'dist/webchat',
      html: 'index.html',
      js: 'webchat.botonic.js',
      css: 'webchat.botonic.css',
    },
    webviews: {
      dir: 'dist/webviews',
      html: 'index.html',
      js: 'webviews.botonic.js',
      css: 'webviews.botonic.css',
    },
    node: {
      dir: 'src/server/lambda/dist',
      js: 'index.js',
    },
  } as const,

  // Cache & build settings
  CACHE_DIR: {
    webchat: '../../node_modules/.vite/apps/<%= projectName %>-webchat',
    webviews: '../../node_modules/.vite/apps/<%= projectName %>-webviews',
    node: '../../node_modules/.vite/apps/<%= projectName %>-node',
  },
  PUBLIC_DIR: 'public',

  // Server ports
  SERVER: {
    webchat: { port: 4201, preview: 4300 },
    webviews: { port: 4202, preview: 4301 },
  } as const,
}

export type TargetApp =
  (typeof BUILD_CONFIG.TARGET_APPS)[keyof typeof BUILD_CONFIG.TARGET_APPS]

export type ClientTargetApp = 'webchat' | 'webviews'
