Line data Source code
1 : import 'package:equatable/equatable.dart'; 2 : import 'package:hive_flutter/adapters.dart'; 3 : import 'package:json_annotation/json_annotation.dart'; 4 : 5 : import '../local_storage.dart'; 6 : 7 : part 'chatwoot_contact.g.dart'; 8 : 9 : @JsonSerializable(explicitToJson: true) 10 : @HiveType(typeId: CHATWOOT_CONTACT_HIVE_TYPE_ID) 11 : class ChatwootContact extends Equatable { 12 : ///unique identifier of contact 13 : @JsonKey(name: "id") 14 : @HiveField(0) 15 : final int id; 16 : 17 : ///Source id of contact obtained on contact create 18 : @JsonKey(name: "source_id") 19 : @HiveField(1) 20 : final String? contactIdentifier; 21 : 22 : ///Token for subscribing to websocket stream events 23 : @JsonKey(name: "pubsub_token") 24 : @HiveField(2) 25 : final String pubsubToken; 26 : 27 : ///Full name of contact 28 : @JsonKey() 29 : @HiveField(3) 30 : final String name; 31 : 32 : ///Email of contact 33 : @JsonKey() 34 : @HiveField(4) 35 : final String email; 36 : 37 8 : ChatwootContact({ 38 : required this.id, 39 : required this.contactIdentifier, 40 : required this.pubsubToken, 41 : required this.name, 42 : required this.email, 43 : }); 44 : 45 8 : factory ChatwootContact.fromJson(Map<String, dynamic> json) => 46 8 : _$ChatwootContactFromJson(json); 47 : 48 0 : Map<String, dynamic> toJson() => _$ChatwootContactToJson(this); 49 : 50 2 : @override 51 12 : List<Object?> get props => [id, contactIdentifier, pubsubToken, name, email]; 52 : }