blob: 4d7b664850ccf677c3454cc16f678e60d36359c8 [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.EnvironmentDataSpecifications;
13using Newtonsoft.Json;
14using System.Collections.Generic;
15using System.Linq;
16using System.Xml.Serialization;
17
18namespace BaSyx.Models.Export
19{
20 public class EnvironmentConceptDescription_V1_0 : EnvironmentIdentifiable_V1_0, IModelType
21 {
22 [JsonIgnore]
23 [XmlElement("embeddedDataSpecification")]
24 public EmbeddedDataSpecification_V1_0 EmbeddedDataSpecification
25 {
26 get => EmbeddedDataSpecifications?.FirstOrDefault();
27 set
28 {
29 if (EmbeddedDataSpecifications == null)
30 EmbeddedDataSpecifications = new List<EmbeddedDataSpecification_V1_0>();
31 EmbeddedDataSpecifications.Insert(0, value);
32 }
33 }
34
35 [JsonProperty("embeddedDataSpecifications")]
36 [XmlIgnore]
37 public List<EmbeddedDataSpecification_V1_0> EmbeddedDataSpecifications { get; set; } = new List<EmbeddedDataSpecification_V1_0>();
38
39 [JsonProperty("isCaseOf")]
40 [XmlElement("isCaseOf")]
41 public List<EnvironmentReference_V1_0> IsCaseOf { get; set; }
42
43 [JsonProperty("modelType")]
44 [XmlIgnore]
45 public ModelType ModelType => ModelType.ConceptDescription;
Constantin Ziesche02817f12020-08-04 21:40:43 +020046
47 public bool ShouldSerializeEmbeddedDataSpecifications()
48 {
49 if (EmbeddedDataSpecifications == null || EmbeddedDataSpecifications.Count == 0)
50 return false;
51 else
52 return true;
53 }
54 public bool ShouldSerializeIsCaseOf()
55 {
56 if (IsCaseOf == null || IsCaseOf.Count == 0)
57 return false;
58 else
59 return true;
60 }
Constantin Ziesche857c7ab2020-02-25 11:24:51 +010061 }
62
63 public class EmbeddedDataSpecification_V1_0
64 {
65 [JsonProperty("hasDataSpecification")]
66 [XmlElement("hasDataSpecification")]
67 public EnvironmentReference_V1_0 HasDataSpecification { get; set; }
68
69 [JsonProperty("dataSpecificationContent")]
70 [XmlElement("dataSpecificationContent")]
71 public DataSpecificationContent_V1_0 DataSpecificationContent { get; set; }
72 }
73
74 public class DataSpecificationContent_V1_0
75 {
76 [XmlElement("dataSpecificationIEC61360")]
77 public EnvironmentDataSpecificationIEC61360_V1_0 DataSpecificationIEC61360 { get; set; }
78 }
79}