com.babylonhealth.lit.usbase_java.builders.Cqf_questionnaireBuilder Maven / Gradle / Ivy
package com.babylonhealth.lit.usbase_java.builders;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Stream;
import java.util.stream.Collectors;
import scala.math.BigDecimal;
import scala.Option;
import scala.collection.immutable.Seq;
import scala.jdk.javaapi.CollectionConverters;
import scala.jdk.javaapi.OptionConverters;
import lombok.NonNull;
import com.babylonhealth.lit.core.FHIRComponentFieldMeta;
import com.babylonhealth.lit.core.FHIRDateTime;
import com.babylonhealth.lit.core.FHIRDate;
import com.babylonhealth.lit.core.LitSeqJCollector;
import com.babylonhealth.lit.core.LitSeq;
import com.babylonhealth.lit.core.LitSeq$;
import com.babylonhealth.lit.core.NonEmptyLitSeqJCollector;
import com.babylonhealth.lit.core.Choice;
import com.babylonhealth.lit.core.Choice$;
import com.babylonhealth.lit.core.model.*;
import com.babylonhealth.lit.hl7.model.*;
import com.babylonhealth.lit.usbase.model.*;
import com.babylonhealth.lit.core_java.builders.*;
import com.babylonhealth.lit.hl7_java.builders.*;
import com.babylonhealth.lit.usbase_java.builders.*;
import com.babylonhealth.lit.core_java.model.Unions.*;
import com.babylonhealth.lit.hl7_java.model.Unions.*;
import com.babylonhealth.lit.usbase_java.model.Unions.*;
import com.babylonhealth.lit.hl7.PUBLICATION_STATUS;
import com.babylonhealth.lit.core.LANGUAGES;
import com.babylonhealth.lit.hl7.RESOURCE_TYPES;
import com.babylonhealth.lit.core.$bslash$div;
import com.babylonhealth.lit.core_java.LitUtils;
import static com.babylonhealth.lit.core_java.LitUtils.autoSuffix;
import static com.babylonhealth.lit.core_java.LitUtils.guard;
import static java.util.stream.Collectors.toList;
public interface Cqf_questionnaireBuilder extends QuestionnaireBuilder {
public Cqf_questionnaire build();
public static Impl init(PUBLICATION_STATUS status) {
return new Impl(status);
}
public static Impl builder(PUBLICATION_STATUS status) {
return new Impl(status);
}
public class Impl implements Cqf_questionnaireBuilder {
private Optional id = Optional.empty();
private Optional url = Optional.empty();
private Optional meta =
Optional.of(
MetaBuilder.init()
.withProfile("http://hl7.org/fhir/StructureDefinition/cqf-questionnaire")
.build());
private Optional text = Optional.empty();
private Optional name = Optional.empty();
private Optional date = Optional.empty();
private Collection code = Collections.emptyList();
private Optional title = Optional.empty();
private PUBLICATION_STATUS status;
private Optional version = Optional.empty();
private Collection contact = Collections.emptyList();
private Optional purpose = Optional.empty();
private Optional language = Optional.empty();
private Collection contained = Collections.emptyList();
private Collection extension = Collections.emptyList();
private Optional publisher = Optional.empty();
private Optional copyright = Optional.empty();
private Collection identifier = Collections.emptyList();
private Collection useContext = Collections.emptyList();
private Collection derivedFrom = Collections.emptyList();
private Collection subjectType = Collections.emptyList();
private Optional description = Optional.empty();
private Optional experimental = Optional.empty();
private Collection jurisdiction = Collections.emptyList();
private Optional approvalDate = Optional.empty();
private Optional implicitRules = Optional.empty();
private Optional lastReviewDate = Optional.empty();
private Optional effectivePeriod = Optional.empty();
private Collection modifierExtension = Collections.emptyList();
private Collection item = Collections.emptyList();
/**
* Required fields for {@link Cqf_questionnaire}
*
* @param status - The status of this questionnaire. Enables tracking the life-cycle of the
* content.
*/
public Impl(PUBLICATION_STATUS status) {
this.status = status;
}
/**
* @param id - The logical id of the resource, as used in the URL for the resource. Once
* assigned, this value never changes.
*/
public Cqf_questionnaireBuilder.Impl withId(@NonNull String id) {
this.id = Optional.of(id);
return this;
}
/**
* @param url - An absolute URI that is used to identify this questionnaire when it is
* referenced in a specification, model, design or an instance; also called its canonical
* identifier. This SHOULD be globally unique and SHOULD be a literal address at which at
* which an authoritative instance of this questionnaire is (or will be) published. This URL
* can be the target of a canonical reference. It SHALL remain the same when the
* questionnaire is stored on different servers.
*/
public Cqf_questionnaireBuilder.Impl withUrl(@NonNull String url) {
this.url = Optional.of(url);
return this;
}
/**
* @param meta - The metadata about the resource. This is content that is maintained by the
* infrastructure. Changes to the content might not always be associated with version
* changes to the resource.
*/
public Cqf_questionnaireBuilder.Impl withMeta(@NonNull Meta meta) {
this.meta = Optional.of(meta);
return this;
}
public Cqf_questionnaireBuilder.Impl withMeta(@NonNull MetaBuilder meta) {
this.meta = Optional.of(meta.build());
return this;
}
/**
* @param text - A human-readable narrative that contains a summary of the resource and can be
* used to represent the content of the resource to a human. The narrative need not encode
* all the structured data, but is required to contain sufficient detail to make it
* "clinically safe" for a human to just read the narrative. Resource definitions may define
* what content should be represented in the narrative to ensure clinical safety.
*/
public Cqf_questionnaireBuilder.Impl withText(@NonNull Narrative text) {
this.text = Optional.of(text);
return this;
}
public Cqf_questionnaireBuilder.Impl withText(@NonNull NarrativeBuilder text) {
this.text = Optional.of(text.build());
return this;
}
/**
* @param name - A natural language name identifying the questionnaire. This name should be
* usable as an identifier for the module by machine processing applications such as code
* generation.
*/
public Cqf_questionnaireBuilder.Impl withName(@NonNull String name) {
this.name = Optional.of(name);
return this;
}
/**
* @param date - The date (and optionally time) when the questionnaire was published. The date
* must change when the business version changes and it must change if the status code
* changes. In addition, it should change when the substantive content of the questionnaire
* changes.
*/
public Cqf_questionnaireBuilder.Impl withDate(@NonNull FHIRDateTime date) {
this.date = Optional.of(date);
return this;
}
/**
* @param code - An identifier for this question or group of questions in a particular
* terminology such as LOINC.
*/
public Cqf_questionnaireBuilder.Impl withCode(@NonNull Coding... code) {
this.code = Arrays.asList(code);
return this;
}
/**
* @param code - An identifier for this question or group of questions in a particular
* terminology such as LOINC.
*/
public Cqf_questionnaireBuilder.Impl withCode(@NonNull Collection code) {
this.code = Collections.unmodifiableCollection(code);
return this;
}
public Cqf_questionnaireBuilder.Impl withCode(@NonNull CodingBuilder... code) {
this.code = Arrays.stream(code).map(e -> e.build()).collect(toList());
return this;
}
/** @param title - A short, descriptive, user-friendly title for the questionnaire. */
public Cqf_questionnaireBuilder.Impl withTitle(@NonNull String title) {
this.title = Optional.of(title);
return this;
}
/**
* @param version - The identifier that is used to identify this version of the questionnaire
* when it is referenced in a specification, model, design or instance. This is an arbitrary
* value managed by the questionnaire author and is not expected to be globally unique. For
* example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available.
* There is also no expectation that versions can be placed in a lexicographical sequence.
*/
public Cqf_questionnaireBuilder.Impl withVersion(@NonNull String version) {
this.version = Optional.of(version);
return this;
}
/**
* @param contact - Contact details to assist a user in finding and communicating with the
* publisher.
*/
public Cqf_questionnaireBuilder.Impl withContact(@NonNull ContactDetail... contact) {
this.contact = Arrays.asList(contact);
return this;
}
/**
* @param contact - Contact details to assist a user in finding and communicating with the
* publisher.
*/
public Cqf_questionnaireBuilder.Impl withContact(@NonNull Collection contact) {
this.contact = Collections.unmodifiableCollection(contact);
return this;
}
public Cqf_questionnaireBuilder.Impl withContact(@NonNull ContactDetailBuilder... contact) {
this.contact = Arrays.stream(contact).map(e -> e.build()).collect(toList());
return this;
}
/**
* @param purpose - Explanation of why this questionnaire is needed and why it has been designed
* as it has.
*/
public Cqf_questionnaireBuilder.Impl withPurpose(@NonNull String purpose) {
this.purpose = Optional.of(purpose);
return this;
}
/** @param language - The base language in which the resource is written. */
public Cqf_questionnaireBuilder.Impl withLanguage(@NonNull LANGUAGES language) {
this.language = Optional.of(language);
return this;
}
/**
* @param contained - These resources do not have an independent existence apart from the
* resource that contains them - they cannot be identified independently, and nor can they
* have their own independent transaction scope.
*/
public Cqf_questionnaireBuilder.Impl withContained(@NonNull Resource... contained) {
this.contained = Arrays.asList(contained);
return this;
}
/**
* @param contained - These resources do not have an independent existence apart from the
* resource that contains them - they cannot be identified independently, and nor can they
* have their own independent transaction scope.
*/
public Cqf_questionnaireBuilder.Impl withContained(@NonNull Collection contained) {
this.contained = Collections.unmodifiableCollection(contained);
return this;
}
public Cqf_questionnaireBuilder.Impl withContained(@NonNull ResourceBuilder... contained) {
this.contained = Arrays.stream(contained).map(e -> e.build()).collect(toList());
return this;
}
/** @param extension - An Extension */
public Cqf_questionnaireBuilder.Impl withExtension(@NonNull Extension... extension) {
this.extension = Arrays.asList(extension);
return this;
}
/** @param extension - An Extension */
public Cqf_questionnaireBuilder.Impl withExtension(@NonNull Collection extension) {
this.extension = Collections.unmodifiableCollection(extension);
return this;
}
public Cqf_questionnaireBuilder.Impl withExtension(@NonNull ExtensionBuilder... extension) {
this.extension = Arrays.stream(extension).map(e -> e.build()).collect(toList());
return this;
}
/**
* @param publisher - The name of the organization or individual that published the
* questionnaire.
*/
public Cqf_questionnaireBuilder.Impl withPublisher(@NonNull String publisher) {
this.publisher = Optional.of(publisher);
return this;
}
/**
* @param copyright - A copyright statement relating to the questionnaire and/or its contents.
* Copyright statements are generally legal restrictions on the use and publishing of the
* questionnaire.
*/
public Cqf_questionnaireBuilder.Impl withCopyright(@NonNull String copyright) {
this.copyright = Optional.of(copyright);
return this;
}
/**
* @param identifier - A formal identifier that is used to identify this questionnaire when it
* is represented in other formats, or referenced in a specification, model, design or an
* instance.
*/
public Cqf_questionnaireBuilder.Impl withIdentifier(@NonNull Identifier... identifier) {
this.identifier = Arrays.asList(identifier);
return this;
}
/**
* @param identifier - A formal identifier that is used to identify this questionnaire when it
* is represented in other formats, or referenced in a specification, model, design or an
* instance.
*/
public Cqf_questionnaireBuilder.Impl withIdentifier(
@NonNull Collection identifier) {
this.identifier = Collections.unmodifiableCollection(identifier);
return this;
}
public Cqf_questionnaireBuilder.Impl withIdentifier(@NonNull IdentifierBuilder... identifier) {
this.identifier = Arrays.stream(identifier).map(e -> e.build()).collect(toList());
return this;
}
/**
* @param useContext - The content was developed with a focus and intent of supporting the
* contexts that are listed. These contexts may be general categories (gender, age, ...) or
* may be references to specific programs (insurance plans, studies, ...) and may be used to
* assist with indexing and searching for appropriate questionnaire instances.
*/
public Cqf_questionnaireBuilder.Impl withUseContext(@NonNull UsageContext... useContext) {
this.useContext = Arrays.asList(useContext);
return this;
}
/**
* @param useContext - The content was developed with a focus and intent of supporting the
* contexts that are listed. These contexts may be general categories (gender, age, ...) or
* may be references to specific programs (insurance plans, studies, ...) and may be used to
* assist with indexing and searching for appropriate questionnaire instances.
*/
public Cqf_questionnaireBuilder.Impl withUseContext(
@NonNull Collection useContext) {
this.useContext = Collections.unmodifiableCollection(useContext);
return this;
}
public Cqf_questionnaireBuilder.Impl withUseContext(
@NonNull UsageContextBuilder... useContext) {
this.useContext = Arrays.stream(useContext).map(e -> e.build()).collect(toList());
return this;
}
/** @param derivedFrom - The URL of a Questionnaire that this Questionnaire is based on. */
public Cqf_questionnaireBuilder.Impl withDerivedFrom(@NonNull String... derivedFrom) {
this.derivedFrom = Arrays.asList(derivedFrom);
return this;
}
/** @param derivedFrom - The URL of a Questionnaire that this Questionnaire is based on. */
public Cqf_questionnaireBuilder.Impl withDerivedFrom(@NonNull Collection derivedFrom) {
this.derivedFrom = Collections.unmodifiableCollection(derivedFrom);
return this;
}
/**
* @param subjectType - The types of subjects that can be the subject of responses created for
* the questionnaire.
*/
public Cqf_questionnaireBuilder.Impl withSubjectType(@NonNull RESOURCE_TYPES... subjectType) {
this.subjectType = Arrays.asList(subjectType);
return this;
}
/**
* @param subjectType - The types of subjects that can be the subject of responses created for
* the questionnaire.
*/
public Cqf_questionnaireBuilder.Impl withSubjectType(
@NonNull Collection subjectType) {
this.subjectType = Collections.unmodifiableCollection(subjectType);
return this;
}
/**
* @param description - A free text natural language description of the questionnaire from a
* consumer's perspective.
*/
public Cqf_questionnaireBuilder.Impl withDescription(@NonNull String description) {
this.description = Optional.of(description);
return this;
}
/**
* @param experimental - A Boolean value to indicate that this questionnaire is authored for
* testing purposes (or education/evaluation/marketing) and is not intended to be used for
* genuine usage.
*/
public Cqf_questionnaireBuilder.Impl withExperimental(@NonNull Boolean experimental) {
this.experimental = Optional.of(experimental);
return this;
}
/**
* @param jurisdiction - A legal or geographic region in which the questionnaire is intended to
* be used.
*/
public Cqf_questionnaireBuilder.Impl withJurisdiction(
@NonNull CodeableConcept... jurisdiction) {
this.jurisdiction = Arrays.asList(jurisdiction);
return this;
}
/**
* @param jurisdiction - A legal or geographic region in which the questionnaire is intended to
* be used.
*/
public Cqf_questionnaireBuilder.Impl withJurisdiction(
@NonNull Collection jurisdiction) {
this.jurisdiction = Collections.unmodifiableCollection(jurisdiction);
return this;
}
public Cqf_questionnaireBuilder.Impl withJurisdiction(
@NonNull CodeableConceptBuilder... jurisdiction) {
this.jurisdiction = Arrays.stream(jurisdiction).map(e -> e.build()).collect(toList());
return this;
}
/**
* @param approvalDate - The date on which the resource content was approved by the publisher.
* Approval happens once when the content is officially approved for usage.
*/
public Cqf_questionnaireBuilder.Impl withApprovalDate(@NonNull FHIRDate approvalDate) {
this.approvalDate = Optional.of(approvalDate);
return this;
}
/**
* @param implicitRules - A reference to a set of rules that were followed when the resource was
* constructed, and which must be understood when processing the content. Often, this is a
* reference to an implementation guide that defines the special rules along with other
* profiles etc.
*/
public Cqf_questionnaireBuilder.Impl withImplicitRules(@NonNull String implicitRules) {
this.implicitRules = Optional.of(implicitRules);
return this;
}
/**
* @param lastReviewDate - The date on which the resource content was last reviewed. Review
* happens periodically after approval but does not change the original approval date.
*/
public Cqf_questionnaireBuilder.Impl withLastReviewDate(@NonNull FHIRDate lastReviewDate) {
this.lastReviewDate = Optional.of(lastReviewDate);
return this;
}
/**
* @param effectivePeriod - The period during which the questionnaire content was or is planned
* to be in active use.
*/
public Cqf_questionnaireBuilder.Impl withEffectivePeriod(@NonNull Period effectivePeriod) {
this.effectivePeriod = Optional.of(effectivePeriod);
return this;
}
public Cqf_questionnaireBuilder.Impl withEffectivePeriod(
@NonNull PeriodBuilder effectivePeriod) {
this.effectivePeriod = Optional.of(effectivePeriod.build());
return this;
}
/**
* @param modifierExtension - May be used to represent additional information that is not part
* of the basic definition of the resource and that modifies the understanding of the
* element that contains it and/or the understanding of the containing element's
* descendants. Usually modifier elements provide negation or qualification. To make the use
* of extensions safe and manageable, there is a strict set of governance applied to the
* definition and use of extensions. Though any implementer is allowed to define an
* extension, there is a set of requirements that SHALL be met as part of the definition of
* the extension. Applications processing a resource are required to check for modifier
* extensions.
* Modifier extensions SHALL NOT change the meaning of any elements on Resource or
* DomainResource (including cannot change the meaning of modifierExtension itself).
*/
public Cqf_questionnaireBuilder.Impl withModifierExtension(
@NonNull Extension... modifierExtension) {
this.modifierExtension = Arrays.asList(modifierExtension);
return this;
}
/**
* @param modifierExtension - May be used to represent additional information that is not part
* of the basic definition of the resource and that modifies the understanding of the
* element that contains it and/or the understanding of the containing element's
* descendants. Usually modifier elements provide negation or qualification. To make the use
* of extensions safe and manageable, there is a strict set of governance applied to the
* definition and use of extensions. Though any implementer is allowed to define an
* extension, there is a set of requirements that SHALL be met as part of the definition of
* the extension. Applications processing a resource are required to check for modifier
* extensions.
*
Modifier extensions SHALL NOT change the meaning of any elements on Resource or
* DomainResource (including cannot change the meaning of modifierExtension itself).
*/
public Cqf_questionnaireBuilder.Impl withModifierExtension(
@NonNull Collection modifierExtension) {
this.modifierExtension = Collections.unmodifiableCollection(modifierExtension);
return this;
}
public Cqf_questionnaireBuilder.Impl withModifierExtension(
@NonNull ExtensionBuilder... modifierExtension) {
this.modifierExtension =
Arrays.stream(modifierExtension).map(e -> e.build()).collect(toList());
return this;
}
/**
* @param item - A particular question, question grouping or display text that is part of the
* questionnaire.
*/
public Cqf_questionnaireBuilder.Impl withItem(@NonNull Questionnaire.Item... item) {
this.item = Arrays.asList(item);
return this;
}
/**
* @param item - A particular question, question grouping or display text that is part of the
* questionnaire.
*/
public Cqf_questionnaireBuilder.Impl withItem(@NonNull Collection item) {
this.item = Collections.unmodifiableCollection(item);
return this;
}
public Cqf_questionnaireBuilder.Impl withItem(@NonNull Questionnaire_ItemBuilder... item) {
this.item = Arrays.stream(item).map(e -> e.build()).collect(toList());
return this;
}
public Cqf_questionnaireBuilder.Impl withoutMeta() {
this.meta = Optional.empty();
return this;
}
public Cqf_questionnaire build() {
return new Cqf_questionnaire(
OptionConverters.toScala(id),
OptionConverters.toScala(url),
OptionConverters.toScala(meta),
OptionConverters.toScala(text),
OptionConverters.toScala(name),
OptionConverters.toScala(date),
code.stream().collect(new LitSeqJCollector<>()),
OptionConverters.toScala(title),
status,
OptionConverters.toScala(version),
contact.stream().collect(new LitSeqJCollector<>()),
OptionConverters.toScala(purpose),
OptionConverters.toScala(language),
contained.stream().collect(new LitSeqJCollector<>()),
extension.stream().collect(new LitSeqJCollector<>()),
OptionConverters.toScala(publisher),
OptionConverters.toScala(copyright),
identifier.stream().collect(new LitSeqJCollector<>()),
useContext.stream().collect(new LitSeqJCollector<>()),
derivedFrom.stream().collect(new LitSeqJCollector<>()),
subjectType.stream().collect(new LitSeqJCollector<>()),
OptionConverters.toScala(description),
OptionConverters.toScala(experimental.map(x -> (Object) x)),
jurisdiction.stream().collect(new LitSeqJCollector<>()),
OptionConverters.toScala(approvalDate),
OptionConverters.toScala(implicitRules),
OptionConverters.toScala(lastReviewDate),
OptionConverters.toScala(effectivePeriod),
modifierExtension.stream().collect(new LitSeqJCollector<>()),
item.stream().collect(new LitSeqJCollector<>()),
LitUtils.emptyMetaElMap());
}
}
}