/*
 * Elastic License 2.0
 * Copyright (C) 2025–present Raman Marozau, Work Target Insight Function. All rights reserved.
 * Contact: raman@worktif.com
 *
 * This file is part of the Licensed Work: worktif.runtime.cdk <worktif_runtime_cdk>.
 * Use of this software is governed by the Elastic License 2.0; see the LICENSE file
 * or https://www.elastic.co/licensing/elastic-license for details.
 *
 * Re-licensing notice:
 *   This file was previously distributed under the Business Source License 1.1 (BUSL-1.1).
 *   As of 2025-09-22, it is re-licensed under Elastic License 2.0.
 *
 * SPDX-License-Identifier: Elastic-2.0
 */

import { RuntimeConfig } from '@worktif/runtime';

/**
 * Runtime CLI Configuration
 *
 * This file defines the configuration for your Runtime application,
 * including deployment stages, paths, and feature flags.
 */
const config: RuntimeConfig = {
  /**
   * Project name used for AWS resource naming
   */
  projectName: '{{PROJECT_NAME}}',

  /**
   * Deployment stages configuration
   * Each stage can have its own AWS region, profile, and domain settings
   * Note: Region is resolved from AWS SDK default provider chain (env vars, ~/.aws/config)
   * The awsRegion value here is used as a fallback if no region is configured
   */
  stages: [
    {
      name: 'dev',
      awsRegion: '{{REGION}}', // Fallback region if not configured in AWS
      awsProfile: 'default', // Optional: AWS CLI profile name
      // domain: 'example.com', // Optional: Custom domain
      // subdomain: 'dev', // Optional: Subdomain prefix
    },
    {
      name: 'staging',
      awsRegion: 'us-east-1', // Fallback region if not configured in AWS
      awsProfile: 'default',
      // domain: 'example.com',
      // subdomain: 'staging',
    },
    {
      name: 'prod',
      awsRegion: 'us-east-1', // Fallback region if not configured in AWS
      awsProfile: 'default',
      // domain: 'example.com',
      // subdomain: 'www',
    },
  ],

  /**
   * Project paths configuration
   */
  paths: {
    srcDir: 'src',
    reactEntry: 'src/index.tsx',
    outDir: 'out/dist',
    cdkDir: 'cdk', // Optional: CDK infrastructure directory
  },

  /**
   * Infrastructure mode
   * - 'cdk': Use AWS CDK for infrastructure (recommended)
   * - 'auto': Automatic infrastructure management
   */
  infraMode: 'cdk',

  /**
   * Optional feature flags
   */
  features: {
    /**
     * Enable SEO metadata storage in DynamoDB
     */
    enableSeo: false,

    /**
     * Enable web app manifest generation
     */
    enableManifest: true,

    /**
     * Enable Lambda warmup to reduce cold starts
     */
    enableWarmup: false,

    /**
     * A configuration setting that determines whether the cache should be cleared on deployment.
     * When set to true, the cache will be cleared every time a deployment occurs.
     */
    clearCacheOnDeploy: true,
  },
};

export default config;
