1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package gov.nist.secauto.metaschema.schemagen.json.impl;
7   
8   import gov.nist.secauto.metaschema.core.model.IFlagInstance;
9   import gov.nist.secauto.metaschema.core.qname.IEnhancedQName;
10  
11  import java.util.List;
12  
13  import edu.umd.cs.findbugs.annotations.NonNull;
14  import edu.umd.cs.findbugs.annotations.Nullable;
15  
16  /**
17   * Supports generation of a JSON schema based on a Metaschema model definition,
18   * which can be generated inline or as a JSON schema definition.
19   */
20  public interface IJsonSchemaModelDefinition extends IJsonSchemaDefinition {
21    /**
22     * Get the name of the JSON key flag.
23     *
24     * @return the name or {@code null} if a JSON property key is not used
25     */
26    @Nullable
27    default IEnhancedQName getJsonKeyFlagName() {
28      IFlagInstance jsonKey = getJsonKeyFlag();
29      return jsonKey == null ? null : jsonKey.getQName();
30    }
31  
32    /**
33     * Get the JSON key flag.
34     *
35     * @return the flag or {@code null} if a JSON property key is not used
36     */
37    @Nullable
38    IFlagInstance getJsonKeyFlag();
39  
40    /**
41     * Get the list of flags to use as properties.
42     * <p>
43     * This list will not include the JSON key flag.
44     *
45     * @return the list of flag JSON schema properties
46     */
47    @NonNull
48    List<IJsonSchemaPropertyFlag> getFlagProperties();
49  }