/**
 * Copyright (c) 2010-2023 Contributors to the openHAB project
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 */
module org.openhab.core.model.rule.GenerateRules

import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*

var rootPath = ".."
var fileExtensions = "rules"
var projectName = "org.openhab.core.model.rule"
var languageName = "org.openhab.core.model.rule.Rules"
var generateXtendStub = true
var encoding = "UTF-8"

Workflow {
  component = XtextGenerator {
    configuration = {
      project = StandardProjectConfig {
        baseName = projectName 
        rootPath = rootPath
        runtimeTest = {
          enabled = false
        }
        genericIde = {
          enabled = true
        }
        eclipsePlugin = {
          enabled = false
        }
        eclipsePluginTest = {
          enabled = false
        }
        createEclipseMetaData = true
      }
      code = {
        encoding = encoding
        fileHeader = "/*\n * generated by Xtext \${version}\n */"
      }
    }
    language = StandardLanguage {
      name = languageName
      fileExtensions = fileExtensions
      referencedResource = "platform:/resource/org.openhab.core.model.script/model/generated/Script.ecore"
      referencedResource = "platform:/resource/org.openhab.core.model.script/model/generated/Script.genmodel"
      serializer = {
        generateStub = generateXtendStub
      }
    }
  }
}
