/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you 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 demoapp.dom.types.javalang.strings.vm;

import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import org.apache.isis.applib.annotation.Collection;
import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.MemberSupport;
import org.apache.isis.applib.annotation.Nature;
import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Title;

import lombok.Getter;
import lombok.Setter;

import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
import demoapp.dom.types.javalang.strings.holder.JavaLangStringHolder2;

//tag::class[]
@XmlRootElement(name = "root")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@DomainObject(
        nature=Nature.VIEW_MODEL,
        logicalTypeName = "demo.JavaLangStringVm"
)
@lombok.NoArgsConstructor                                                       // <.>
public class JavaLangStringVm
        implements HasAsciiDocDescription, JavaLangStringHolder2 {

//end::class[]
    public JavaLangStringVm(final String initialValue) {
        this.readOnlyProperty = initialValue;
        this.readWriteProperty = initialValue;
    }

//tag::class[]
    @Title(prepend = "Stringview model: ")
    @PropertyLayout(fieldSetId = "read-only-properties", sequence = "1")
    @XmlElement(required = true)                                                // <.>
    @Getter @Setter
    private String readOnlyProperty;

    @Property(editing = Editing.ENABLED)                                        // <.>
    @PropertyLayout(fieldSetId = "editable-properties", sequence = "1")
    @XmlElement(required = true)
    @Getter @Setter
    private String readWriteProperty;

    @Property(optionality = Optionality.OPTIONAL)                               // <.>
    @PropertyLayout(fieldSetId = "optional-properties", sequence = "1")
    @Getter @Setter
    private String readOnlyOptionalProperty;

    @Property(editing = Editing.ENABLED, optionality = Optionality.OPTIONAL)
    @PropertyLayout(fieldSetId = "optional-properties", sequence = "2")
    @Getter @Setter
    private String readWriteOptionalProperty;

    @Property
    @Getter @Setter
    private String imperativeProp;
    @MemberSupport public String namedImperativeProp() {
        return "prop" + readOnlyProperty;
    }

    @Collection
    public List<JavaLangStringVm> getMulitple() {
        return List.of(
                new JavaLangStringVm("hi"),
                new JavaLangStringVm("ho"));
    }

}
//end::class[]

@@ -871,32 +871,8 @@
 m;%0A%0A
-import java.util.List;%0A%0A
 impo
@@ -1106,61 +1106,8 @@
 e;%0A%0A
-import org.apache.isis.applib.annotation.Collection;%0A
 impo
@@ -1211,64 +1211,8 @@
 ng;%0A
-import org.apache.isis.applib.annotation.MemberSupport;%0A
 impo
@@ -3171,369 +3171,8 @@
 y;%0A%0A
-    @Property%0A    @Getter @Setter%0A    private String imperativeProp;%0A    @MemberSupport public String namedImperativeProp() %7B%0A        return %22prop%22 + readOnlyProperty;%0A    %7D%0A%0A    @Collection%0A    public List%3CJavaLangStringVm%3E getMulitple() %7B%0A        return List.of(%0A                new JavaLangStringVm(%22hi%22),%0A                new JavaLangStringVm(%22ho%22));%0A    %7D%0A%0A
 %7D%0A//

remove debug code from prev. commit