|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +# |
| 4 | +# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file |
| 7 | +# except in compliance with the License. A copy of the License is located at |
| 8 | +# |
| 9 | +# http://aws.amazon.com/apache2.0/ |
| 10 | +# |
| 11 | +# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for |
| 13 | +# the specific language governing permissions and limitations under the License. |
| 14 | +# |
| 15 | + |
| 16 | +import pprint |
| 17 | +import re # noqa: F401 |
| 18 | +import six |
| 19 | +import typing |
| 20 | +from enum import Enum |
| 21 | +from ask_sdk_model.services.timer_management.operation import Operation |
| 22 | + |
| 23 | + |
| 24 | +if typing.TYPE_CHECKING: |
| 25 | + from typing import Dict, List, Optional, Union |
| 26 | + from datetime import datetime |
| 27 | + from ask_sdk_model.services.timer_management.text_to_announce import TextToAnnounce |
| 28 | + |
| 29 | + |
| 30 | +class AnnounceOperation(Operation): |
| 31 | + """ |
| 32 | + ANNOUNCE trigger behavior represents announcing a certain text that the developer wants to be read out at the expiration of the timer. |
| 33 | +
|
| 34 | +
|
| 35 | + :param text_to_announce: |
| 36 | + :type text_to_announce: (optional) list[ask_sdk_model.services.timer_management.text_to_announce.TextToAnnounce] |
| 37 | +
|
| 38 | + """ |
| 39 | + deserialized_types = { |
| 40 | + 'object_type': 'str', |
| 41 | + 'text_to_announce': 'list[ask_sdk_model.services.timer_management.text_to_announce.TextToAnnounce]' |
| 42 | + } # type: Dict |
| 43 | + |
| 44 | + attribute_map = { |
| 45 | + 'object_type': 'type', |
| 46 | + 'text_to_announce': 'textToAnnounce' |
| 47 | + } # type: Dict |
| 48 | + supports_multiple_types = False |
| 49 | + |
| 50 | + def __init__(self, text_to_announce=None): |
| 51 | + # type: (Optional[List[TextToAnnounce]]) -> None |
| 52 | + """ANNOUNCE trigger behavior represents announcing a certain text that the developer wants to be read out at the expiration of the timer. |
| 53 | +
|
| 54 | + :param text_to_announce: |
| 55 | + :type text_to_announce: (optional) list[ask_sdk_model.services.timer_management.text_to_announce.TextToAnnounce] |
| 56 | + """ |
| 57 | + self.__discriminator_value = "ANNOUNCE" # type: str |
| 58 | + |
| 59 | + self.object_type = self.__discriminator_value |
| 60 | + super(AnnounceOperation, self).__init__(object_type=self.__discriminator_value) |
| 61 | + self.text_to_announce = text_to_announce |
| 62 | + |
| 63 | + def to_dict(self): |
| 64 | + # type: () -> Dict[str, object] |
| 65 | + """Returns the model properties as a dict""" |
| 66 | + result = {} # type: Dict |
| 67 | + |
| 68 | + for attr, _ in six.iteritems(self.deserialized_types): |
| 69 | + value = getattr(self, attr) |
| 70 | + if isinstance(value, list): |
| 71 | + result[attr] = list(map( |
| 72 | + lambda x: x.to_dict() if hasattr(x, "to_dict") else |
| 73 | + x.value if isinstance(x, Enum) else x, |
| 74 | + value |
| 75 | + )) |
| 76 | + elif isinstance(value, Enum): |
| 77 | + result[attr] = value.value |
| 78 | + elif hasattr(value, "to_dict"): |
| 79 | + result[attr] = value.to_dict() |
| 80 | + elif isinstance(value, dict): |
| 81 | + result[attr] = dict(map( |
| 82 | + lambda item: (item[0], item[1].to_dict()) |
| 83 | + if hasattr(item[1], "to_dict") else |
| 84 | + (item[0], item[1].value) |
| 85 | + if isinstance(item[1], Enum) else item, |
| 86 | + value.items() |
| 87 | + )) |
| 88 | + else: |
| 89 | + result[attr] = value |
| 90 | + |
| 91 | + return result |
| 92 | + |
| 93 | + def to_str(self): |
| 94 | + # type: () -> str |
| 95 | + """Returns the string representation of the model""" |
| 96 | + return pprint.pformat(self.to_dict()) |
| 97 | + |
| 98 | + def __repr__(self): |
| 99 | + # type: () -> str |
| 100 | + """For `print` and `pprint`""" |
| 101 | + return self.to_str() |
| 102 | + |
| 103 | + def __eq__(self, other): |
| 104 | + # type: (object) -> bool |
| 105 | + """Returns true if both objects are equal""" |
| 106 | + if not isinstance(other, AnnounceOperation): |
| 107 | + return False |
| 108 | + |
| 109 | + return self.__dict__ == other.__dict__ |
| 110 | + |
| 111 | + def __ne__(self, other): |
| 112 | + # type: (object) -> bool |
| 113 | + """Returns true if both objects are not equal""" |
| 114 | + return not self == other |
0 commit comments