001package gov.nist.secauto.oscal.lib.model;
002
003import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValue;
004import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValues;
005import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
006import gov.nist.secauto.metaschema.binding.model.annotations.Matches;
007import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaField;
008import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaFieldValue;
009import gov.nist.secauto.metaschema.binding.model.annotations.ValueConstraints;
010import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
011import gov.nist.secauto.metaschema.model.common.datatype.adapter.StringAdapter;
012import java.lang.Override;
013import java.lang.String;
014import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
015import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
016
017/**
018 * A telephone service number as defined by <a href="https://www.itu.int/rec/T-REC-E.164-201011-I/en">ITU-T E.164</a>.
019 */
020@MetaschemaField(
021    formalName = "Telephone Number",
022    description = "A telephone service number as defined by [ITU-T E.164](https://www.itu.int/rec/T-REC-E.164-201011-I/en).",
023    name = "telephone-number",
024    metaschema = OscalMetadataMetaschema.class,
025    isCollapsible = false
026)
027@ValueConstraints(
028    matches = @Matches(level = IConstraint.Level.WARNING, pattern = "^[0-9]{3}[0-9]{1,12}$", remarks = "Providing a country code provides an international means to interpret the phone number.")
029)
030public class TelephoneNumber {
031  @MetaschemaFieldValue(
032      valueKeyName = "number"
033  )
034  private String _value;
035
036  @BoundFlag(
037      formalName = "type flag",
038      description = "Indicates the type of phone number.",
039      useName = "type",
040      typeAdapter = StringAdapter.class
041  )
042  @ValueConstraints(
043      allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "home", description = "A home phone number."), @AllowedValue(value = "office", description = "An office phone number."), @AllowedValue(value = "mobile", description = "A mobile phone number.")})
044  )
045  private String _type;
046
047  public TelephoneNumber() {
048  }
049
050  public String getValue() {
051    return _value;
052  }
053
054  public void setValue(String value) {
055    _value = value;
056  }
057
058  public String getType() {
059    return _type;
060  }
061
062  public void setType(String value) {
063    _type = value;
064  }
065
066  @Override
067  public String toString() {
068    return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
069  }
070}