blob: 250719050f2ff709ac3288a27c628a4cc0bc244c [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_V2_0 : SubmodelElementType_V2_0, IModelType
20 {
21 [JsonProperty("value"), JsonConverter(typeof(JsonSubmodelElementConverter_V1_0))]
22 [XmlArray("value")]
23 [XmlArrayItem("submodelElement")]
24 public List<EnvironmentSubmodelElement_V2_0> Value { get; set; }
25
26 [JsonProperty("ordered")]
27 [XmlElement("ordered")]
28 public bool Ordered { get; set; }
29
30 [JsonProperty("allowDuplicates")]
31 [XmlElement("allowDuplicates")]
32 public bool AllowDuplicates { get; set; }
Constantin Ziesche02817f12020-08-04 21:40:43 +020033
Constantin Ziesche857c7ab2020-02-25 11:24:51 +010034 [JsonProperty("modelType")]
35 [XmlIgnore]
36 public override ModelType ModelType => ModelType.SubmodelElementCollection;
37
38 public SubmodelElementCollection_V2_0() { }
39 public SubmodelElementCollection_V2_0(SubmodelElementType_V2_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}