/*
 * This file is part of the DITA Open Toolkit project.
 *
 * Copyright 2019 Jarno Elovirta
 *
 * See the accompanying LICENSE file for applicable license.
 */

package org.dita.dost.project;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.net.URI;
import java.util.List;
import java.util.stream.Collectors;

public class ProjectBuilder {

    @JsonProperty("deliverables")
    public List<Deliverable> deliverables;
    @JsonProperty("includes")
    public List<URI> includes;
    @JsonProperty("publications")
    public List<Publication> publications;
    @JsonProperty("contexts")
    public List<Context> contexts;

    @JsonCreator
    public ProjectBuilder(@JsonProperty("deliverables") List<Deliverable> deliverables,
                          @JsonProperty("includes") List<URI> includes,
                          @JsonProperty("publications") List<Publication> publications,
                          @JsonProperty("contexts") List<Context> contexts) {
        this.deliverables = deliverables;
        this.includes = includes;
        this.publications = publications;
        this.contexts = contexts;
    }

    public static class Deliverable {
        public String name;
        public Context context;
        public URI output;
        public Publication publication;

        @JsonCreator
        public Deliverable(@JsonProperty("name") String name,
                           @JsonProperty("context") Context context,
                           @JsonProperty("output") URI output,
                           @JsonProperty("publication") Publication publication) {
            this.name = name;
            this.context = context;
            this.output = output;
            this.publication = publication;
        }

//        public static class Inputs {
//            public List<Input> inputs;
//
//            @JsonCreator
//            public Inputs(@JsonProperty("inputs") List<Input> inputs) {
//                this.inputs = inputs;
//            }
//
//            public static class Input {
//                public URI href;
//
//                @JsonCreator
//                public Input(@JsonProperty("href") URI href) {
//                    this.href = href;
//                }
//            }
//        }

        public static class Profile {
            public List<URI> ditavals;

            @JsonCreator
            public Profile(@JsonProperty("ditavals") List<URI> ditavals) {
                this.ditavals = ditavals;
            }

//            public static class DitaVal {
//                public URI href;
//
//                @JsonCreator
//                public DitaVal(@JsonProperty("href") URI href) {
//                    this.href = href;
//                }
//            }
        }

    }

    public static class ProjectRef {
        public URI href;

        @JsonCreator
        public ProjectRef(@JsonProperty("href") URI href) {
            this.href = href;
        }
    }

    public static class Context {
        public String name;
        public String id;
        public String idref;
        public List<URI> inputs;
        public Deliverable.Profile profiles;

        @JsonCreator
        public Context(@JsonProperty("name") String name,
                       @JsonProperty("id") String id,
                       @JsonProperty("idref") String idref,
                       @JsonProperty("inputs") List<URI> inputs,
                       @JsonProperty("profiles") Deliverable.Profile profiles) {
            this.name = name;
            this.id = id;
            this.idref = idref;
            this.inputs = inputs;
            this.profiles = profiles;
        }
    }

    public static class Publication {
        public String name;
        public String id;
        public String idref;
        public String transtype;
        public List<Param> params;

        @JsonCreator
        public Publication(@JsonProperty("name") String name,
                           @JsonProperty("id") String id,
                           @JsonProperty("idref") String idref,
                           @JsonProperty("transtype") String transtype,
                           @JsonProperty("params") List<Param> params) {
            this.name = name;
            this.id = id;
            this.idref = idref;
            this.transtype = transtype;
            this.params = params;
        }

        public static class Param {
            public String name;
            public String value;
            public URI href;

            @JsonCreator
            public Param(
                    @JsonProperty("name") String name,
                    @JsonProperty("value") String value,
                    @JsonProperty("href") URI href) {
                this.name = name;
                this.value = value;
                this.href = href;
            }
        }
    }
}

@@ -343,44 +343,8 @@
 ist;
-%0Aimport java.util.stream.Collectors;
 %0A%0Apu
@@ -1778,1208 +1778,252 @@
  %7D%0A%0A
-//        public static class Inputs %7B%0A//            public List%3CInput%3E inputs;%0A//%0A//            @JsonCreator%0A//            public Inputs(@JsonProperty(%22inputs%22) List%3CInput%3E inputs) %7B%0A//                this.inputs = inputs;%0A//            %7D%0A//%0A//            public static class Input %7B%0A//                public URI href;%0A//%0A//                @JsonCreator%0A//                public Input(@JsonProperty(%22href%22) URI href) %7B%0A//                    this.href = href;%0A//                %7D%0A//            %7D%0A//        %7D%0A%0A        public static class Profile %7B%0A            public List%3CURI%3E ditavals;%0A%0A            @JsonCreator%0A            public Profile(@JsonProperty(%22ditavals%22) List%3CURI%3E ditavals) %7B%0A                this.ditavals = ditavals;%0A            %7D%0A%0A//            public static class DitaVal %7B%0A//                public URI href;%0A//%0A//                @JsonCreator%0A//                public DitaVal(@JsonProperty(%22href%22) URI href) %7B%0A//                    this.href = href;%0A//                %7D%0A//            %7D%0A        %7D%0A%0A    %7D%0A%0A    public static class ProjectRef %7B%0A        public URI href;%0A%0A        @JsonCreator%0A        public ProjectRef(@JsonProperty(%22href%22) URI href) %7B%0A            this.href = href;%0A        %7D
+        public static class Profile %7B%0A            public List%3CURI%3E ditavals;%0A%0A            @JsonCreator%0A            public Profile(@JsonProperty(%22ditavals%22) List%3CURI%3E ditavals) %7B%0A                this.ditavals = ditavals;%0A            %7D%0A        %7D%0A
 %0A   

Clean unused code