|
| 1 | +/* |
| 2 | +* Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | +* |
| 4 | +* Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | +* You may not use this file except in compliance with the License. |
| 6 | +* A copy of the License is located at |
| 7 | +* |
| 8 | +* http://aws.amazon.com/apache2.0 |
| 9 | +* |
| 10 | +* or in the "license" file accompanying this file. This file is distributed |
| 11 | +* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | +* express or implied. See the License for the specific language governing |
| 13 | +* permissions and limitations under the License. |
| 14 | +*/ |
| 15 | + |
| 16 | +// NOTE: This file is generated and may not follow lint rules defined in your app |
| 17 | +// Generated files can be excluded from analysis in analysis_options.yaml |
| 18 | +// For more info, see: https://dart.dev/guides/language/analysis-options#excluding-code-from-analysis |
| 19 | + |
| 20 | +// ignore_for_file: public_member_api_docs, annotate_overrides, dead_code, dead_codepublic_member_api_docs, depend_on_referenced_packages, file_names, library_private_types_in_public_api, no_leading_underscores_for_library_prefixes, no_leading_underscores_for_local_identifiers, non_constant_identifier_names, null_check_on_nullable_type_parameter, prefer_adjacent_string_concatenation, prefer_const_constructors, prefer_if_null_operators, prefer_interpolation_to_compose_strings, slash_for_doc_comments, sort_child_properties_last, unnecessary_const, unnecessary_constructor_name, unnecessary_late, unnecessary_new, unnecessary_null_aware_assignments, unnecessary_nullable_for_final_variable_declarations, unnecessary_string_interpolations, use_build_context_synchronously |
| 21 | + |
| 22 | +import 'MtmModelProvider.dart'; |
| 23 | +import 'package:amplify_core/amplify_core.dart'; |
| 24 | +import 'package:flutter/foundation.dart'; |
| 25 | + |
| 26 | +/** This is an auto generated class representing the FirstMtmRelation type in your schema. */ |
| 27 | +@immutable |
| 28 | +class FirstMtmRelation extends Model { |
| 29 | + static const classType = const _FirstMtmRelationModelType(); |
| 30 | + final String id; |
| 31 | + final ManyToManyPrimary? _manyToManyPrimary; |
| 32 | + final ManyToManySecondary? _manyToManySecondary; |
| 33 | + final TemporalDateTime? _createdAt; |
| 34 | + final TemporalDateTime? _updatedAt; |
| 35 | + |
| 36 | + @override |
| 37 | + getInstanceType() => classType; |
| 38 | + |
| 39 | + @override |
| 40 | + String getId() { |
| 41 | + return id; |
| 42 | + } |
| 43 | + |
| 44 | + ManyToManyPrimary get manyToManyPrimary { |
| 45 | + try { |
| 46 | + return _manyToManyPrimary!; |
| 47 | + } catch (e) { |
| 48 | + throw new AmplifyCodeGenModelException( |
| 49 | + AmplifyExceptionMessages |
| 50 | + .codeGenRequiredFieldForceCastExceptionMessage, |
| 51 | + recoverySuggestion: AmplifyExceptionMessages |
| 52 | + .codeGenRequiredFieldForceCastRecoverySuggestion, |
| 53 | + underlyingException: e.toString()); |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + ManyToManySecondary get manyToManySecondary { |
| 58 | + try { |
| 59 | + return _manyToManySecondary!; |
| 60 | + } catch (e) { |
| 61 | + throw new AmplifyCodeGenModelException( |
| 62 | + AmplifyExceptionMessages |
| 63 | + .codeGenRequiredFieldForceCastExceptionMessage, |
| 64 | + recoverySuggestion: AmplifyExceptionMessages |
| 65 | + .codeGenRequiredFieldForceCastRecoverySuggestion, |
| 66 | + underlyingException: e.toString()); |
| 67 | + } |
| 68 | + } |
| 69 | + |
| 70 | + TemporalDateTime? get createdAt { |
| 71 | + return _createdAt; |
| 72 | + } |
| 73 | + |
| 74 | + TemporalDateTime? get updatedAt { |
| 75 | + return _updatedAt; |
| 76 | + } |
| 77 | + |
| 78 | + const FirstMtmRelation._internal( |
| 79 | + {required this.id, |
| 80 | + required manyToManyPrimary, |
| 81 | + required manyToManySecondary, |
| 82 | + createdAt, |
| 83 | + updatedAt}) |
| 84 | + : _manyToManyPrimary = manyToManyPrimary, |
| 85 | + _manyToManySecondary = manyToManySecondary, |
| 86 | + _createdAt = createdAt, |
| 87 | + _updatedAt = updatedAt; |
| 88 | + |
| 89 | + factory FirstMtmRelation( |
| 90 | + {String? id, |
| 91 | + required ManyToManyPrimary manyToManyPrimary, |
| 92 | + required ManyToManySecondary manyToManySecondary}) { |
| 93 | + return FirstMtmRelation._internal( |
| 94 | + id: id == null ? UUID.getUUID() : id, |
| 95 | + manyToManyPrimary: manyToManyPrimary, |
| 96 | + manyToManySecondary: manyToManySecondary); |
| 97 | + } |
| 98 | + |
| 99 | + bool equals(Object other) { |
| 100 | + return this == other; |
| 101 | + } |
| 102 | + |
| 103 | + @override |
| 104 | + bool operator ==(Object other) { |
| 105 | + if (identical(other, this)) return true; |
| 106 | + return other is FirstMtmRelation && |
| 107 | + id == other.id && |
| 108 | + _manyToManyPrimary == other._manyToManyPrimary && |
| 109 | + _manyToManySecondary == other._manyToManySecondary; |
| 110 | + } |
| 111 | + |
| 112 | + @override |
| 113 | + int get hashCode => toString().hashCode; |
| 114 | + |
| 115 | + @override |
| 116 | + String toString() { |
| 117 | + var buffer = new StringBuffer(); |
| 118 | + |
| 119 | + buffer.write("FirstMtmRelation {"); |
| 120 | + buffer.write("id=" + "$id" + ", "); |
| 121 | + buffer.write("manyToManyPrimary=" + |
| 122 | + (_manyToManyPrimary != null ? _manyToManyPrimary!.toString() : "null") + |
| 123 | + ", "); |
| 124 | + buffer.write("manyToManySecondary=" + |
| 125 | + (_manyToManySecondary != null |
| 126 | + ? _manyToManySecondary!.toString() |
| 127 | + : "null") + |
| 128 | + ", "); |
| 129 | + buffer.write("createdAt=" + |
| 130 | + (_createdAt != null ? _createdAt!.format() : "null") + |
| 131 | + ", "); |
| 132 | + buffer.write( |
| 133 | + "updatedAt=" + (_updatedAt != null ? _updatedAt!.format() : "null")); |
| 134 | + buffer.write("}"); |
| 135 | + |
| 136 | + return buffer.toString(); |
| 137 | + } |
| 138 | + |
| 139 | + FirstMtmRelation copyWith( |
| 140 | + {String? id, |
| 141 | + ManyToManyPrimary? manyToManyPrimary, |
| 142 | + ManyToManySecondary? manyToManySecondary}) { |
| 143 | + return FirstMtmRelation._internal( |
| 144 | + id: id ?? this.id, |
| 145 | + manyToManyPrimary: manyToManyPrimary ?? this.manyToManyPrimary, |
| 146 | + manyToManySecondary: manyToManySecondary ?? this.manyToManySecondary); |
| 147 | + } |
| 148 | + |
| 149 | + FirstMtmRelation.fromJson(Map<String, dynamic> json) |
| 150 | + : id = json['id'], |
| 151 | + _manyToManyPrimary = |
| 152 | + json['manyToManyPrimary']?['serializedData'] != null |
| 153 | + ? ManyToManyPrimary.fromJson(new Map<String, dynamic>.from( |
| 154 | + json['manyToManyPrimary']['serializedData'])) |
| 155 | + : null, |
| 156 | + _manyToManySecondary = |
| 157 | + json['manyToManySecondary']?['serializedData'] != null |
| 158 | + ? ManyToManySecondary.fromJson(new Map<String, dynamic>.from( |
| 159 | + json['manyToManySecondary']['serializedData'])) |
| 160 | + : null, |
| 161 | + _createdAt = json['createdAt'] != null |
| 162 | + ? TemporalDateTime.fromString(json['createdAt']) |
| 163 | + : null, |
| 164 | + _updatedAt = json['updatedAt'] != null |
| 165 | + ? TemporalDateTime.fromString(json['updatedAt']) |
| 166 | + : null; |
| 167 | + |
| 168 | + Map<String, dynamic> toJson() => { |
| 169 | + 'id': id, |
| 170 | + 'manyToManyPrimary': _manyToManyPrimary?.toJson(), |
| 171 | + 'manyToManySecondary': _manyToManySecondary?.toJson(), |
| 172 | + 'createdAt': _createdAt?.format(), |
| 173 | + 'updatedAt': _updatedAt?.format() |
| 174 | + }; |
| 175 | + |
| 176 | + static final QueryField ID = QueryField(fieldName: "id"); |
| 177 | + static final QueryField MANYTOMANYPRIMARY = QueryField( |
| 178 | + fieldName: "manyToManyPrimary", |
| 179 | + fieldType: ModelFieldType(ModelFieldTypeEnum.model, |
| 180 | + ofModelName: (ManyToManyPrimary).toString())); |
| 181 | + static final QueryField MANYTOMANYSECONDARY = QueryField( |
| 182 | + fieldName: "manyToManySecondary", |
| 183 | + fieldType: ModelFieldType(ModelFieldTypeEnum.model, |
| 184 | + ofModelName: (ManyToManySecondary).toString())); |
| 185 | + static var schema = |
| 186 | + Model.defineSchema(define: (ModelSchemaDefinition modelSchemaDefinition) { |
| 187 | + modelSchemaDefinition.name = "FirstMtmRelation"; |
| 188 | + modelSchemaDefinition.pluralName = "FirstMtmRelations"; |
| 189 | + |
| 190 | + modelSchemaDefinition.addField(ModelFieldDefinition.id()); |
| 191 | + |
| 192 | + modelSchemaDefinition.addField(ModelFieldDefinition.belongsTo( |
| 193 | + key: FirstMtmRelation.MANYTOMANYPRIMARY, |
| 194 | + isRequired: true, |
| 195 | + targetName: "manyToManyPrimaryID", |
| 196 | + ofModelName: (ManyToManyPrimary).toString())); |
| 197 | + |
| 198 | + modelSchemaDefinition.addField(ModelFieldDefinition.belongsTo( |
| 199 | + key: FirstMtmRelation.MANYTOMANYSECONDARY, |
| 200 | + isRequired: true, |
| 201 | + targetName: "manyToManySecondaryID", |
| 202 | + ofModelName: (ManyToManySecondary).toString())); |
| 203 | + |
| 204 | + modelSchemaDefinition.addField(ModelFieldDefinition.nonQueryField( |
| 205 | + fieldName: 'createdAt', |
| 206 | + isRequired: false, |
| 207 | + isReadOnly: true, |
| 208 | + ofType: ModelFieldType(ModelFieldTypeEnum.dateTime))); |
| 209 | + |
| 210 | + modelSchemaDefinition.addField(ModelFieldDefinition.nonQueryField( |
| 211 | + fieldName: 'updatedAt', |
| 212 | + isRequired: false, |
| 213 | + isReadOnly: true, |
| 214 | + ofType: ModelFieldType(ModelFieldTypeEnum.dateTime))); |
| 215 | + }); |
| 216 | +} |
| 217 | + |
| 218 | +class _FirstMtmRelationModelType extends ModelType<FirstMtmRelation> { |
| 219 | + const _FirstMtmRelationModelType(); |
| 220 | + |
| 221 | + @override |
| 222 | + FirstMtmRelation fromJson(Map<String, dynamic> jsonData) { |
| 223 | + return FirstMtmRelation.fromJson(jsonData); |
| 224 | + } |
| 225 | +} |
0 commit comments