// Path: kramer/src/main/java/com/chiralbehaviors/layout/schema/Relation.java
// public class Relation extends SchemaNode {
//     private boolean                autoFold = true;
//     private final List<SchemaNode> children = new ArrayList<>();
//     private Relation               fold;
// 
//     public Relation(String label) {
//         super(label);
//     }
// 
//     public void addChild(SchemaNode child) {
//         children.add(child);
//     }
// 
//     public Relation getAutoFoldable() {
//         if (fold != null) {
//             return fold;
//         }
//         return autoFold && children.size() == 1
//                && children.get(children.size() - 1) instanceof Relation
//                                                                         ? (Relation) children.get(0)
//                                                                         : null;
//     }
// 
//     public SchemaNode getChild(String field) {
//         for (SchemaNode child : children) {
//             if (child.getField()
//                      .equals(field)) {
//                 return child;
//             }
//         }
//         return null;
//     }
// 
//     public List<SchemaNode> getChildren() {
//         return children;
//     }
// 
//     public Relation getFold() {
//         return fold;
//     }
// 
//     @JsonProperty
//     public boolean isFold() {
//         return fold != null;
//     }
// 
//     @Override
//     public boolean isRelation() {
//         return true;
//     }
// 
//     public void setFold(boolean fold) {
//         this.fold = (fold && children.size() == 1 && children.get(0)
//                                                              .isRelation()) ? (Relation) children.get(0)
//                                                                             : null;
//     }
// 
//     @Override
//     public String toString() {
//         return toString(0);
//     }
// 
//     @Override
//     public String toString(int indent) {
//         StringBuffer buf = new StringBuffer();
//         buf.append(String.format("Relation [%s]", label));
//         buf.append('\n');
//         children.forEach(c -> {
//             for (int i = 0; i < indent; i++) {
//                 buf.append("    ");
//             }
//             buf.append("  - ");
//             buf.append(c.toString(indent + 1));
//             if (!c.equals(children.get(children.size() - 1))) {
//                 buf.append('\n');
//             }
//         });
//         return buf.toString();
//     }
// }


import java.util.Map;
import com.chiralbehaviors.layout.schema.Relation;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
 * Copyright (c) 2016 Chiral Behaviors, LLC, all rights reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.chiralbehaviors.layout.toy;



/**
 * 
 * @author hhildebrand
 *
 */
public class Page {
    public static class Route {
        @JsonProperty
        private String              path;
        @JsonProperty
        private Map<String, String> extract;

        public String getPath() {
            return path;
        }

        public Map<String, String> getExtract() {
            return extract;
        }
    }

    @JsonProperty
    private String             endpoint;
    @JsonProperty
    private String             query;
    @JsonProperty
    private Map<String, Route> routing;
    @JsonProperty
    private String             title;

    public String getQuery() {
        return query;
    }

// Path: kramer/src/main/java/com/chiralbehaviors/layout/schema/Relation.java
// public class Relation extends SchemaNode {
//     private boolean                autoFold = true;
//     private final List<SchemaNode> children = new ArrayList<>();
//     private Relation               fold;
// 
//     public Relation(String label) {
//         super(label);
//     }
// 
//     public void addChild(SchemaNode child) {
//         children.add(child);
//     }
// 
//     public Relation getAutoFoldable() {
//         if (fold != null) {
//             return fold;
//         }
//         return autoFold && children.size() == 1
//                && children.get(children.size() - 1) instanceof Relation
//                                                                         ? (Relation) children.get(0)
//                                                                         : null;
//     }
// 
//     public SchemaNode getChild(String field) {
//         for (SchemaNode child : children) {
//             if (child.getField()
//                      .equals(field)) {
//                 return child;
//             }
//         }
//         return null;
//     }
// 
//     public List<SchemaNode> getChildren() {
//         return children;
//     }
// 
//     public Relation getFold() {
//         return fold;
//     }
// 
//     @JsonProperty
//     public boolean isFold() {
//         return fold != null;
//     }
// 
//     @Override
//     public boolean isRelation() {
//         return true;
//     }
// 
//     public void setFold(boolean fold) {
//         this.fold = (fold && children.size() == 1 && children.get(0)
//                                                              .isRelation()) ? (Relation) children.get(0)
//                                                                             : null;
//     }
// 
//     @Override
//     public String toString() {
//         return toString(0);
//     }
// 
//     @Override
//     public String toString(int indent) {
//         StringBuffer buf = new StringBuffer();
//         buf.append(String.format("Relation [%s]", label));
//         buf.append('\n');
//         children.forEach(c -> {
//             for (int i = 0; i < indent; i++) {
//                 buf.append("    ");
//             }
//             buf.append("  - ");
//             buf.append(c.toString(indent + 1));
//             if (!c.equals(children.get(children.size() - 1))) {
//                 buf.append('\n');
//             }
//         });
//         return buf.toString();
//     }
// }


// Path: toy-app/src/main/java/com/chiralbehaviors/layout/toy/Page.java
import java.util.Map;
import com.chiralbehaviors.layout.schema.Relation;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Copyright (c) 2016 Chiral Behaviors, LLC, all rights reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.chiralbehaviors.layout.toy;



/**
 * 
 * @author hhildebrand
 *
 */
public class Page {
    public static class Route {
        @JsonProperty
        private String              path;
        @JsonProperty
        private Map<String, String> extract;

        public String getPath() {
            return path;
        }

        public Map<String, String> getExtract() {
            return extract;
        }
    }

    @JsonProperty
    private String             endpoint;
    @JsonProperty
    private String             query;
    @JsonProperty
    private Map<String, Route> routing;
    @JsonProperty
    private String             title;

    public String getQuery() {
        return query;
    }

    public Route getRoute(Relation relation) {