1// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates.  All rights reserved.
2// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
3// Code generated. DO NOT EDIT.
4
5// Data Integration API
6//
7// Use the Data Integration Service APIs to perform common extract, load, and transform (ETL) tasks.
8//
9
10package dataintegration
11
12import (
13	"encoding/json"
14	"github.com/oracle/oci-go-sdk/common"
15)
16
17// CompositeFieldMap A composite field map.
18type CompositeFieldMap struct {
19
20	// Detailed description for the object.
21	Description *string `mandatory:"false" json:"description"`
22
23	// The key of the object.
24	Key *string `mandatory:"false" json:"key"`
25
26	// The model version of an object.
27	ModelVersion *string `mandatory:"false" json:"modelVersion"`
28
29	ParentRef *ParentReference `mandatory:"false" json:"parentRef"`
30
31	ConfigValues *ConfigValues `mandatory:"false" json:"configValues"`
32
33	// The status of an object that can be set to value 1 for shallow references across objects, other values reserved.
34	ObjectStatus *int `mandatory:"false" json:"objectStatus"`
35
36	// An array of field maps.
37	FieldMaps []FieldMap `mandatory:"false" json:"fieldMaps"`
38}
39
40//GetDescription returns Description
41func (m CompositeFieldMap) GetDescription() *string {
42	return m.Description
43}
44
45func (m CompositeFieldMap) String() string {
46	return common.PointerString(m)
47}
48
49// MarshalJSON marshals to json representation
50func (m CompositeFieldMap) MarshalJSON() (buff []byte, e error) {
51	type MarshalTypeCompositeFieldMap CompositeFieldMap
52	s := struct {
53		DiscriminatorParam string `json:"modelType"`
54		MarshalTypeCompositeFieldMap
55	}{
56		"COMPOSITE_FIELD_MAP",
57		(MarshalTypeCompositeFieldMap)(m),
58	}
59
60	return json.Marshal(&s)
61}
62
63// UnmarshalJSON unmarshals from json
64func (m *CompositeFieldMap) UnmarshalJSON(data []byte) (e error) {
65	model := struct {
66		Description  *string          `json:"description"`
67		Key          *string          `json:"key"`
68		ModelVersion *string          `json:"modelVersion"`
69		ParentRef    *ParentReference `json:"parentRef"`
70		ConfigValues *ConfigValues    `json:"configValues"`
71		ObjectStatus *int             `json:"objectStatus"`
72		FieldMaps    []fieldmap       `json:"fieldMaps"`
73	}{}
74
75	e = json.Unmarshal(data, &model)
76	if e != nil {
77		return
78	}
79	var nn interface{}
80	m.Description = model.Description
81
82	m.Key = model.Key
83
84	m.ModelVersion = model.ModelVersion
85
86	m.ParentRef = model.ParentRef
87
88	m.ConfigValues = model.ConfigValues
89
90	m.ObjectStatus = model.ObjectStatus
91
92	m.FieldMaps = make([]FieldMap, len(model.FieldMaps))
93	for i, n := range model.FieldMaps {
94		nn, e = n.UnmarshalPolymorphicJSON(n.JsonData)
95		if e != nil {
96			return e
97		}
98		if nn != nil {
99			m.FieldMaps[i] = nn.(FieldMap)
100		} else {
101			m.FieldMaps[i] = nil
102		}
103	}
104
105	return
106}
107