/// Root configuration module for Vize.
///
/// Usage in `vize.config.pkl`:
/// ```
/// amends "node_modules/vize/pkl/VizeConfig.pkl"
///
/// formatter {
///   singleQuote = true
/// }
///
/// languageServer {
///   completion = false
/// }
/// ```
module vize.VizeConfig

import "CompilerConfig.pkl"
import "VitePluginConfig.pkl"
import "LinterConfig.pkl"
import "TypeCheckerConfig.pkl"
import "FormatterConfig.pkl"
import "LanguageServerConfig.pkl"
import "MuseaConfig.pkl"
import "GlobalTypesConfig.pkl"

typealias ConfigExtends = String | Listing<String>

/// Vue dialect profile for standalone HTML documents.
/// When absent, the dialect is detected structurally per document.
typealias VueDialect = "vue" | "petite-vue"

class ExperimentalsConfig {
  vapor: Boolean? = null
  jsxVapor: Boolean? = null
  intagComment: Boolean? = null
  inTagComment: Boolean? = null
  pattenedTemplate: Boolean? = null
  patternedTemplate: Boolean? = null
  serverScript: Boolean? = null
}

class ConfigEntry {
  /// Human-readable entry name for inspect output and diagnostics.
  name: String? = null

  /// Directory used as the base for scoped file patterns and relative paths.
  basePath: String? = null

  /// Glob patterns this entry applies to.
  files: Listing<String>? = null

  /// Glob patterns this entry excludes.
  ignores: Listing<String>? = null

  /// Base config files or presets amended by this entry.
  `extends`: ConfigExtends? = null

  /// Vue dialect profile for standalone HTML documents (`"vue"` or `"petite-vue"`).
  /// When absent, the dialect is detected structurally per document.
  dialect: VueDialect? = null

  /// Vue compiler options.
  compiler: CompilerConfig.CompilerConfig = new CompilerConfig.CompilerConfig {}

  /// Experimental RFC opt-ins.
  experimentals: ExperimentalsConfig = new ExperimentalsConfig {}

  /// Vite plugin options.
  vite: VitePluginConfig.VitePluginConfig = new VitePluginConfig.VitePluginConfig {}

  /// Linter options.
  linter: LinterConfig.LinterConfig = new LinterConfig.LinterConfig {}

  /// Type checker options.
  typeChecker: TypeCheckerConfig.TypeCheckerConfig = new TypeCheckerConfig.TypeCheckerConfig {}

  /// Formatter options.
  formatter: FormatterConfig.FormatterConfig = new FormatterConfig.FormatterConfig {}

  /// Language server options.
  languageServer: LanguageServerConfig.LanguageServerConfig = new LanguageServerConfig.LanguageServerConfig {}

  /// Legacy alias for `languageServer`.
  @Deprecated {
    message = "Use languageServer instead."
    replaceWith = "languageServer"
  }
  lsp: LanguageServerConfig.LanguageServerConfig = languageServer

  /// Musea component gallery options.
  musea: MuseaConfig.MuseaConfig = new MuseaConfig.MuseaConfig {}

  /// Global type declarations.
  globalTypes: GlobalTypesConfig.GlobalTypesConfig = new GlobalTypesConfig.GlobalTypesConfig {}
}

/// Human-readable entry name for inspect output and diagnostics.
name: String? = null

/// Directory used as the base for scoped file patterns and relative paths.
basePath: String? = null

/// Glob patterns this config applies to.
files: Listing<String>? = null

/// Glob patterns this config excludes.
ignores: Listing<String>? = null

/// Base config files or presets amended by this config.
`extends`: ConfigExtends? = null

/// Vue dialect profile for standalone HTML documents (`"vue"` or `"petite-vue"`).
/// When absent, the dialect is detected structurally per document.
dialect: VueDialect? = null

/// Vue compiler options.
compiler: CompilerConfig.CompilerConfig = new CompilerConfig.CompilerConfig {}

/// Experimental RFC opt-ins.
experimentals: ExperimentalsConfig = new ExperimentalsConfig {}

/// Vite plugin options.
vite: VitePluginConfig.VitePluginConfig = new VitePluginConfig.VitePluginConfig {}

/// Linter options.
linter: LinterConfig.LinterConfig = new LinterConfig.LinterConfig {}

/// Type checker options.
typeChecker: TypeCheckerConfig.TypeCheckerConfig = new TypeCheckerConfig.TypeCheckerConfig {}

/// Formatter options.
formatter: FormatterConfig.FormatterConfig = new FormatterConfig.FormatterConfig {}

/// Language server options.
languageServer: LanguageServerConfig.LanguageServerConfig = new LanguageServerConfig.LanguageServerConfig {}

/// Legacy alias for `languageServer`.
@Deprecated {
  message = "Use languageServer instead."
  replaceWith = "languageServer"
}
lsp: LanguageServerConfig.LanguageServerConfig = languageServer

/// Musea component gallery options.
musea: MuseaConfig.MuseaConfig = new MuseaConfig.MuseaConfig {}

/// Global type declarations.
globalTypes: GlobalTypesConfig.GlobalTypesConfig = new GlobalTypesConfig.GlobalTypesConfig {}

/// Scoped config entries for monorepos and workspaces.
entries: Listing<ConfigEntry>? = null
