blob: d37674e3eb5f4ca786baed08c0efb0d1addf050d [file] [log] [blame]
Constantin Ziesche857c7ab2020-02-25 11:24:51 +01001/*******************************************************************************
2* Copyright (c) 2020 Robert Bosch GmbH
3* Author: Constantin Ziesche (constantin.ziesche@bosch.com)
4*
5* This program and the accompanying materials are made available under the
6* terms of the Eclipse Public License 2.0 which is available at
7* http://www.eclipse.org/legal/epl-2.0
8*
9* SPDX-License-Identifier: EPL-2.0
10*******************************************************************************/
11using BaSyx.Models.Core.AssetAdministrationShell.Enums;
12using BaSyx.Models.Core.Common;
13using BaSyx.Models.Export.Converter;
14using Newtonsoft.Json;
15using System.Collections.Generic;
16using System.Xml.Serialization;
17
18namespace BaSyx.Models.Export
19{
20 public class EnvironmentSubmodel_V1_0 : EnvironmentIdentifiable_V1_0, IModelType
21 {
Constantin Ziesche857c7ab2020-02-25 11:24:51 +010022 [JsonProperty("kind")]
23 [XmlElement("kind")]
24 public ModelingKind Kind { get; set; }
25
Constantin Ziesche02817f12020-08-04 21:40:43 +020026 [JsonProperty("semanticId")]
27 [XmlElement("semanticId")]
28 public EnvironmentReference_V1_0 SemanticId { get; set; }
29
Constantin Ziesche857c7ab2020-02-25 11:24:51 +010030 [JsonProperty("constraints")]
31 [XmlArray("qualifier")]
32 [XmlArrayItem("qualifier")]
33 public List<EnvironmentQualifier_V1_0> Qualifier { get; set; }
34
35 [JsonProperty("submodelElements"), JsonConverter(typeof(JsonSubmodelElementConverter_V1_0))]
36 [XmlArray("submodelElements")]
37 [XmlArrayItem("submodelElement")]
38 public List<EnvironmentSubmodelElement_V1_0> SubmodelElements { get; set; }
39
40 [JsonProperty("modelType")]
41 [XmlIgnore]
42 public ModelType ModelType => ModelType.Submodel;
Constantin Ziesche02817f12020-08-04 21:40:43 +020043
44 public bool ShouldSerializeSemanticId()
45 {
46 if (SemanticId == null)
47 return false;
48 else
49 return true;
50 }
51
52 public bool ShouldSerializeQualifier()
53 {
54 if (Qualifier == null || Qualifier.Count == 0)
55 return false;
56 else
57 return true;
58 }
59
60 public bool ShouldSerializeSubmodelElements()
61 {
62 if (SubmodelElements == null || SubmodelElements.Count == 0)
63 return false;
64 else
65 return true;
66 }
Constantin Ziesche857c7ab2020-02-25 11:24:51 +010067 }
68}