1# coding: utf-8
2# Copyright (c) 2016, 2021, Oracle and/or its affiliates.  All rights reserved.
3# 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.
4
5
6from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel  # noqa: F401
7from oci.decorators import init_model_state_from_kwargs
8
9
10@init_model_state_from_kwargs
11class UniqueKey(object):
12    """
13    The unqique key object.
14    """
15
16    #: A constant which can be used with the model_type property of a UniqueKey.
17    #: This constant has a value of "PRIMARY_KEY"
18    MODEL_TYPE_PRIMARY_KEY = "PRIMARY_KEY"
19
20    #: A constant which can be used with the model_type property of a UniqueKey.
21    #: This constant has a value of "UNIQUE_KEY"
22    MODEL_TYPE_UNIQUE_KEY = "UNIQUE_KEY"
23
24    def __init__(self, **kwargs):
25        """
26        Initializes a new UniqueKey object with values from keyword arguments. This class has the following subclasses and if you are using this class as input
27        to a service operations then you should favor using a subclass over the base class:
28
29        * :class:`~oci.data_integration.models.PrimaryKey`
30        * :class:`~oci.data_integration.models.UniqueDataKey`
31
32        The following keyword arguments are supported (corresponding to the getters/setters of this class):
33
34        :param model_type:
35            The value to assign to the model_type property of this UniqueKey.
36            Allowed values for this property are: "PRIMARY_KEY", "UNIQUE_KEY", 'UNKNOWN_ENUM_VALUE'.
37            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
38        :type model_type: str
39
40        :param key:
41            The value to assign to the key property of this UniqueKey.
42        :type key: str
43
44        :param model_version:
45            The value to assign to the model_version property of this UniqueKey.
46        :type model_version: str
47
48        :param parent_ref:
49            The value to assign to the parent_ref property of this UniqueKey.
50        :type parent_ref: oci.data_integration.models.ParentReference
51
52        :param name:
53            The value to assign to the name property of this UniqueKey.
54        :type name: str
55
56        :param attribute_refs:
57            The value to assign to the attribute_refs property of this UniqueKey.
58        :type attribute_refs: list[oci.data_integration.models.KeyAttribute]
59
60        :param object_status:
61            The value to assign to the object_status property of this UniqueKey.
62        :type object_status: int
63
64        """
65        self.swagger_types = {
66            'model_type': 'str',
67            'key': 'str',
68            'model_version': 'str',
69            'parent_ref': 'ParentReference',
70            'name': 'str',
71            'attribute_refs': 'list[KeyAttribute]',
72            'object_status': 'int'
73        }
74
75        self.attribute_map = {
76            'model_type': 'modelType',
77            'key': 'key',
78            'model_version': 'modelVersion',
79            'parent_ref': 'parentRef',
80            'name': 'name',
81            'attribute_refs': 'attributeRefs',
82            'object_status': 'objectStatus'
83        }
84
85        self._model_type = None
86        self._key = None
87        self._model_version = None
88        self._parent_ref = None
89        self._name = None
90        self._attribute_refs = None
91        self._object_status = None
92
93    @staticmethod
94    def get_subtype(object_dictionary):
95        """
96        Given the hash representation of a subtype of this class,
97        use the info in the hash to return the class of the subtype.
98        """
99        type = object_dictionary['modelType']
100
101        if type == 'PRIMARY_KEY':
102            return 'PrimaryKey'
103
104        if type == 'UNIQUE_KEY':
105            return 'UniqueDataKey'
106        else:
107            return 'UniqueKey'
108
109    @property
110    def model_type(self):
111        """
112        **[Required]** Gets the model_type of this UniqueKey.
113        The key type.
114
115        Allowed values for this property are: "PRIMARY_KEY", "UNIQUE_KEY", 'UNKNOWN_ENUM_VALUE'.
116        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
117
118
119        :return: The model_type of this UniqueKey.
120        :rtype: str
121        """
122        return self._model_type
123
124    @model_type.setter
125    def model_type(self, model_type):
126        """
127        Sets the model_type of this UniqueKey.
128        The key type.
129
130
131        :param model_type: The model_type of this UniqueKey.
132        :type: str
133        """
134        allowed_values = ["PRIMARY_KEY", "UNIQUE_KEY"]
135        if not value_allowed_none_or_none_sentinel(model_type, allowed_values):
136            model_type = 'UNKNOWN_ENUM_VALUE'
137        self._model_type = model_type
138
139    @property
140    def key(self):
141        """
142        Gets the key of this UniqueKey.
143        The object key.
144
145
146        :return: The key of this UniqueKey.
147        :rtype: str
148        """
149        return self._key
150
151    @key.setter
152    def key(self, key):
153        """
154        Sets the key of this UniqueKey.
155        The object key.
156
157
158        :param key: The key of this UniqueKey.
159        :type: str
160        """
161        self._key = key
162
163    @property
164    def model_version(self):
165        """
166        Gets the model_version of this UniqueKey.
167        The object's model version.
168
169
170        :return: The model_version of this UniqueKey.
171        :rtype: str
172        """
173        return self._model_version
174
175    @model_version.setter
176    def model_version(self, model_version):
177        """
178        Sets the model_version of this UniqueKey.
179        The object's model version.
180
181
182        :param model_version: The model_version of this UniqueKey.
183        :type: str
184        """
185        self._model_version = model_version
186
187    @property
188    def parent_ref(self):
189        """
190        Gets the parent_ref of this UniqueKey.
191
192        :return: The parent_ref of this UniqueKey.
193        :rtype: oci.data_integration.models.ParentReference
194        """
195        return self._parent_ref
196
197    @parent_ref.setter
198    def parent_ref(self, parent_ref):
199        """
200        Sets the parent_ref of this UniqueKey.
201
202        :param parent_ref: The parent_ref of this UniqueKey.
203        :type: oci.data_integration.models.ParentReference
204        """
205        self._parent_ref = parent_ref
206
207    @property
208    def name(self):
209        """
210        Gets the name of this UniqueKey.
211        Free form text without any restriction on permitted characters. Name can have letters, numbers, and special characters. The value is editable and is restricted to 1000 characters.
212
213
214        :return: The name of this UniqueKey.
215        :rtype: str
216        """
217        return self._name
218
219    @name.setter
220    def name(self, name):
221        """
222        Sets the name of this UniqueKey.
223        Free form text without any restriction on permitted characters. Name can have letters, numbers, and special characters. The value is editable and is restricted to 1000 characters.
224
225
226        :param name: The name of this UniqueKey.
227        :type: str
228        """
229        self._name = name
230
231    @property
232    def attribute_refs(self):
233        """
234        Gets the attribute_refs of this UniqueKey.
235        An array of attribute references.
236
237
238        :return: The attribute_refs of this UniqueKey.
239        :rtype: list[oci.data_integration.models.KeyAttribute]
240        """
241        return self._attribute_refs
242
243    @attribute_refs.setter
244    def attribute_refs(self, attribute_refs):
245        """
246        Sets the attribute_refs of this UniqueKey.
247        An array of attribute references.
248
249
250        :param attribute_refs: The attribute_refs of this UniqueKey.
251        :type: list[oci.data_integration.models.KeyAttribute]
252        """
253        self._attribute_refs = attribute_refs
254
255    @property
256    def object_status(self):
257        """
258        Gets the object_status of this UniqueKey.
259        The status of an object that can be set to value 1 for shallow references across objects, other values reserved.
260
261
262        :return: The object_status of this UniqueKey.
263        :rtype: int
264        """
265        return self._object_status
266
267    @object_status.setter
268    def object_status(self, object_status):
269        """
270        Sets the object_status of this UniqueKey.
271        The status of an object that can be set to value 1 for shallow references across objects, other values reserved.
272
273
274        :param object_status: The object_status of this UniqueKey.
275        :type: int
276        """
277        self._object_status = object_status
278
279    def __repr__(self):
280        return formatted_flat_dict(self)
281
282    def __eq__(self, other):
283        if other is None:
284            return False
285
286        return self.__dict__ == other.__dict__
287
288    def __ne__(self, other):
289        return not self == other
290