// Path: dom/src/main/java/todoapp/dom/categories/Category.java
// public enum Category {
//     PROFESSIONAL {
//         @Override
//         public List<Subcategory> subcategories() {
//             return Arrays.asList(null, Subcategory.OPEN_SOURCE, Subcategory.CONSULTING, Subcategory.EDUCATION, Subcategory.MARKETING);
//         }
//     }, DOMESTIC {
//         @Override
//         public List<Subcategory> subcategories() {
//             return Arrays.asList(null, Subcategory.SHOPPING, Subcategory.HOUSEWORK, Subcategory.GARDEN, Subcategory.CHORES);
//         }
//     }, OTHER {
//         @Override
//         public List<Subcategory> subcategories() {
//             return Arrays.asList(null, Subcategory.OTHER);
//         }
//     };
// 
//     public abstract List<Subcategory> subcategories();
// }
// 
// Path: dom/src/main/java/todoapp/dom/categories/Subcategory.java
// public enum Subcategory {
//     // professional
//     OPEN_SOURCE, CONSULTING, EDUCATION, MARKETING,
//     // domestic
//     SHOPPING, HOUSEWORK, GARDEN, CHORES,
//     // other
//     OTHER;
// 
//     public static List<Subcategory> listFor(final Category category) {
//         return category != null? category.subcategories(): Collections.<Subcategory>emptyList();
//     }
// 
//     public static String validate(final Category category, final Subcategory subcategory) {
//         if(category == null) {
//             return "Enter category first";
//         }
//         return !category.subcategories().contains(subcategory)
//                 ? "Invalid subcategory for category '" + category + "'"
//                 : null;
//     }
// 
//     public static Predicate<Subcategory> thoseFor(final Category category) {
//         return new Predicate<Subcategory>() {
// 
//             @Override
//             public boolean apply(final Subcategory subcategory) {
//                 return category.subcategories().contains(subcategory);
//             }
//         };
//     }
// 
// }


import java.math.BigDecimal;
import java.util.List;
import com.google.common.base.Predicates;
import org.joda.time.LocalDate;
import org.apache.isis.applib.DomainObjectContainer;
import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.ActionLayout;
import org.apache.isis.applib.annotation.BookmarkPolicy;
import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.DomainServiceLayout;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.annotation.SemanticsOf;
import org.apache.isis.applib.services.clock.ClockService;
import org.apache.isis.applib.services.i18n.TranslatableString;
import org.isisaddons.module.security.app.user.MeService;
import org.isisaddons.module.security.dom.tenancy.ApplicationTenancy;
import org.isisaddons.module.security.dom.tenancy.ApplicationTenancyRepository;
import org.isisaddons.module.security.dom.user.ApplicationUser;
import org.isisaddons.module.security.dom.user.ApplicationUserRepository;
import todoapp.dom.categories.Category;
import todoapp.dom.categories.Subcategory;
        return false;
    }
    public List<Subcategory> choices1Categorized(
            final Category category) {
        return Subcategory.listFor(category);
    }
    public String validateCategorized(
            final Category category, 
            final Subcategory subcategory, 
            final boolean completed) {
        return Subcategory.validate(category, subcategory);
    }
    //endregion

    //region > newToDo (action)
    @ActionLayout(cssClassFa = "fa fa-plus")
    @MemberOrder(sequence = "5")
    public ToDoItem newToDo(
            @Parameter(regexPattern = "\\w[@&:\\-\\,\\.\\+ \\w]*")
            final String description,
            final Category category,
            @Parameter(optionality = Optionality.OPTIONAL)
            final Subcategory subcategory,
            @Parameter(optionality = Optionality.OPTIONAL)
            final LocalDate dueBy,
            @Parameter(optionality = Optionality.OPTIONAL)
            final BigDecimal cost) {
        return newToDo(description, category, subcategory, currentUserName(), dueBy, cost);
    }
    public Category default1NewToDo() {
// Path: dom/src/main/java/todoapp/dom/categories/Category.java
// public enum Category {
//     PROFESSIONAL {
//         @Override
//         public List<Subcategory> subcategories() {
//             return Arrays.asList(null, Subcategory.OPEN_SOURCE, Subcategory.CONSULTING, Subcategory.EDUCATION, Subcategory.MARKETING);
//         }
//     }, DOMESTIC {
//         @Override
//         public List<Subcategory> subcategories() {
//             return Arrays.asList(null, Subcategory.SHOPPING, Subcategory.HOUSEWORK, Subcategory.GARDEN, Subcategory.CHORES);
//         }
//     }, OTHER {
//         @Override
//         public List<Subcategory> subcategories() {
//             return Arrays.asList(null, Subcategory.OTHER);
//         }
//     };
// 
//     public abstract List<Subcategory> subcategories();
// }
// 
// Path: dom/src/main/java/todoapp/dom/categories/Subcategory.java
// public enum Subcategory {
//     // professional
//     OPEN_SOURCE, CONSULTING, EDUCATION, MARKETING,
//     // domestic
//     SHOPPING, HOUSEWORK, GARDEN, CHORES,
//     // other
//     OTHER;
// 
//     public static List<Subcategory> listFor(final Category category) {
//         return category != null? category.subcategories(): Collections.<Subcategory>emptyList();
//     }
// 
//     public static String validate(final Category category, final Subcategory subcategory) {
//         if(category == null) {
//             return "Enter category first";
//         }
//         return !category.subcategories().contains(subcategory)
//                 ? "Invalid subcategory for category '" + category + "'"
//                 : null;
//     }
// 
//     public static Predicate<Subcategory> thoseFor(final Category category) {
//         return new Predicate<Subcategory>() {
// 
//             @Override
//             public boolean apply(final Subcategory subcategory) {
//                 return category.subcategories().contains(subcategory);
//             }
//         };
//     }
// 
// }


// Path: dom/src/main/java/todoapp/dom/todoitem/ToDoItems.java
import java.math.BigDecimal;
import java.util.List;
import com.google.common.base.Predicates;
import org.joda.time.LocalDate;
import org.apache.isis.applib.DomainObjectContainer;
import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.ActionLayout;
import org.apache.isis.applib.annotation.BookmarkPolicy;
import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.DomainServiceLayout;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.annotation.SemanticsOf;
import org.apache.isis.applib.services.clock.ClockService;
import org.apache.isis.applib.services.i18n.TranslatableString;
import org.isisaddons.module.security.app.user.MeService;
import org.isisaddons.module.security.dom.tenancy.ApplicationTenancy;
import org.isisaddons.module.security.dom.tenancy.ApplicationTenancyRepository;
import org.isisaddons.module.security.dom.user.ApplicationUser;
import org.isisaddons.module.security.dom.user.ApplicationUserRepository;
import todoapp.dom.categories.Category;
import todoapp.dom.categories.Subcategory;

        return false;
    }
    public List<Subcategory> choices1Categorized(
            final Category category) {
        return Subcategory.listFor(category);
    }
    public String validateCategorized(
            final Category category, 
            final Subcategory subcategory, 
            final boolean completed) {
        return Subcategory.validate(category, subcategory);
    }
    //endregion

    //region > newToDo (action)
    @ActionLayout(cssClassFa = "fa fa-plus")
    @MemberOrder(sequence = "5")
    public ToDoItem newToDo(
            @Parameter(regexPattern = "\\w[@&:\\-\\,\\.\\+ \\w]*")
            final String description,
            final Category category,
            @Parameter(optionality = Optionality.OPTIONAL)
            final Subcategory subcategory,
            @Parameter(optionality = Optionality.OPTIONAL)
            final LocalDate dueBy,
            @Parameter(optionality = Optionality.OPTIONAL)
            final BigDecimal cost) {
        return newToDo(description, category, subcategory, currentUserName(), dueBy, cost);
    }
    public Category default1NewToDo() {
        return Category.PROFESSIONAL;