package com.haskforce.jps.model;

import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Tag;

import java.util.List;

/**
 * Serialization object for communicating build settings with the build server.
 */
public class HaskellBuildOptions {
    public HaskellBuildOptions() {
    }

    public HaskellBuildOptions(HaskellBuildOptions options) {
        myUseCabal = options.myUseCabal;
        myUseCabalSandbox = options.myUseCabalSandbox;
        myProfilingBuild = options.myProfilingBuild;
        myGhcPath = options.myGhcPath;
        myCabalPath = options.myCabalPath;
    }

    @Tag("useCabal")
    public boolean myUseCabal = true;

    @Tag("useCabalSandbox")
    public boolean myUseCabalSandbox = false;

    @Tag("useProfilingBuild")
    public boolean myProfilingBuild = true;

    @Tag("ghcPath")
    public String myGhcPath = "ghc";

    @Tag("cabalPath")
    public String myCabalPath = "cabal";

    @Tag("cabalFiles")
    @AbstractCollection(surroundWithTag = false, elementTag = "cabalFile")
    public List<String> myCabalFiles = ContainerUtil.newArrayList();

    @Override
    public String toString() {
        return "HaskellBuildOptions{" +
                "myUseCabal=" + myUseCabal +
                ", myUseCabalSandbox=" + myUseCabalSandbox +
                ", myProfilingBuild=" + myProfilingBuild +
                ", myGhcPath=" + myGhcPath +
                ", myCabalPath=" + myCabalPath +
                ", myCabalFiles=" + myCabalFiles +
                '}';
    }
}

@@ -335,16 +335,328 @@
 tions %7B%0A
+    public static final boolean DEFAULT_USE_CABAL = true;%0A    public static final boolean DEFAULT_USE_CABAL_SANDBOX = false;%0A    public static final boolean DEFAULT_USE_PROFILING_BUILD = true;%0A    public static final String DEFAULT_GHC_PATH = %22ghc%22;%0A    public static final String DEFAULT_CABAL_PATH = %22cabal%22;%0A%0A
     publ
@@ -1042,20 +1042,33 @@
 Cabal = 
-true
+DEFAULT_USE_CABAL
 ;%0A%0A    @
@@ -1129,21 +1129,41 @@
 ndbox = 
-false
+DEFAULT_USE_CABAL_SANDBOX
 ;%0A%0A    @
@@ -1225,20 +1225,43 @@
 Build = 
-true
+DEFAULT_USE_PROFILING_BUILD
 ;%0A%0A    @
@@ -1305,21 +1305,32 @@
 cPath = 
-%22ghc%22
+DEFAULT_GHC_PATH
 ;%0A%0A    @
@@ -1378,23 +1378,34 @@
 lPath = 
-%22cabal%22
+DEFAULT_CABAL_PATH
 ;%0A%0A    @

Make the default build option values into finals.