blob: 0d3fba22ef29aa2bc100da9d84d194d826ffd2d7 [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.Common;
12using BaSyx.Models.Export.Converter;
13using Newtonsoft.Json;
14using System.Collections.Generic;
15using System.Xml.Serialization;
16
17namespace BaSyx.Models.Export
18{
19 public class SubmodelElementCollection_V1_0 : SubmodelElementType_V1_0, IModelType
20 {
Constantin Ziesche02817f12020-08-04 21:40:43 +020021 [JsonProperty("allowDuplicates")]
22 [XmlElement("allowDuplicates")]
23 public bool AllowDuplicates { get; set; }
Constantin Ziesche857c7ab2020-02-25 11:24:51 +010024
25 [JsonProperty("ordered")]
26 [XmlElement("ordered")]
27 public bool Ordered { get; set; }
28
Constantin Ziesche02817f12020-08-04 21:40:43 +020029 [JsonProperty("value"), JsonConverter(typeof(JsonSubmodelElementConverter_V1_0))]
30 [XmlArray("value")]
31 [XmlArrayItem("submodelElement")]
32 public List<EnvironmentSubmodelElement_V1_0> Value { get; set; }
Constantin Ziesche857c7ab2020-02-25 11:24:51 +010033
34 [JsonProperty("modelType")]
35 [XmlIgnore]
36 public override ModelType ModelType => ModelType.SubmodelElementCollection;
37
38 public SubmodelElementCollection_V1_0() { }
39 public SubmodelElementCollection_V1_0(SubmodelElementType_V1_0 submodelElementType) : base(submodelElementType) { }
Constantin Ziesche02817f12020-08-04 21:40:43 +020040
41 public bool ShouldSerializeValue()
42 {
43 if (Value == null || Value.Count == 0)
44 return false;
45 else
46 return true;
47 }
Constantin Ziesche857c7ab2020-02-25 11:24:51 +010048 }
49}