diff --git a/lib/services/cloud/cloud_models.dart b/lib/services/cloud/cloud_models.dart new file mode 100644 index 0000000..421c7da --- /dev/null +++ b/lib/services/cloud/cloud_models.dart @@ -0,0 +1,98 @@ +import 'package:flutter/foundation.dart'; + +/// Stable cloud-facing representation of the MotorSignal rider profile. +/// Firebase UID is the identity; username is a future public handle and is +/// intentionally not used as an account identifier. +@immutable +class CloudUserProfile { + final String id; + final String? username; + final String? displayName; + final String? profilePhotoUrl; + final String? bio; + final String? location; + final DateTime createdAt; + final DateTime updatedAt; + final Map privacySettings; + final Map preferences; + + const CloudUserProfile({ + required this.id, + this.username, + this.displayName, + this.profilePhotoUrl, + this.bio, + this.location, + required this.createdAt, + required this.updatedAt, + this.privacySettings = const {}, + this.preferences = const {}, + }); + + Map toJson() => { + 'id': id, + 'username': username, + 'displayName': displayName, + 'profilePhotoUrl': profilePhotoUrl, + 'bio': bio, + 'location': location, + 'createdAt': createdAt.toUtc().toIso8601String(), + 'updatedAt': updatedAt.toUtc().toIso8601String(), + 'privacySettings': privacySettings, + 'preferences': preferences, + }; +} + +/// Cloud DTO for a motorcycle. Local Drift IDs remain stable within the +/// installation; the string form is used as the Firestore document ID. +@immutable +class CloudMotorcycle { + final String id; + final String ownerId; + final int year; + final String makeId; + final String makeName; + final String modelId; + final String modelName; + final String? variantId; + final String? variantName; + final String? nickname; + final bool isDefault; + final DateTime createdAt; + final DateTime updatedAt; + final String? specificationJson; + + const CloudMotorcycle({ + required this.id, + required this.ownerId, + required this.year, + required this.makeId, + required this.makeName, + required this.modelId, + required this.modelName, + this.variantId, + this.variantName, + this.nickname, + required this.isDefault, + required this.createdAt, + required this.updatedAt, + this.specificationJson, + }); + + Map toJson() => { + 'id': id, + 'ownerId': ownerId, + 'year': year, + 'makeId': makeId, + 'makeName': makeName, + 'modelId': modelId, + 'modelName': modelName, + 'variantId': variantId, + 'variantName': variantName, + 'nickname': nickname, + 'isDefault': isDefault, + 'createdAt': createdAt.toUtc().toIso8601String(), + 'updatedAt': updatedAt.toUtc().toIso8601String(), + 'specificationJson': specificationJson, + }; +}