109 lines
2.7 KiB
Dart
109 lines
2.7 KiB
Dart
class PolicyMember {
|
|
final String id;
|
|
final String name;
|
|
final String relationship;
|
|
|
|
const PolicyMember({
|
|
required this.id,
|
|
required this.name,
|
|
required this.relationship,
|
|
});
|
|
|
|
factory PolicyMember.fromJson(Map<String, dynamic> json) {
|
|
return PolicyMember(
|
|
id: (json['id'] ?? json['employee_id'] ?? '').toString(),
|
|
name: (json['name'] ?? '').toString(),
|
|
relationship: (json['relationship'] ?? '').toString(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ChatbotPolicy {
|
|
final String clientPolicyId;
|
|
final String policyName;
|
|
final String policyType;
|
|
final String eCardDownloadUrl;
|
|
final String networkHospitalsUrl;
|
|
final List<PolicyMember> members;
|
|
|
|
const ChatbotPolicy({
|
|
required this.clientPolicyId,
|
|
required this.policyName,
|
|
required this.policyType,
|
|
required this.eCardDownloadUrl,
|
|
required this.networkHospitalsUrl,
|
|
required this.members,
|
|
});
|
|
|
|
factory ChatbotPolicy.fromJson(Map<String, dynamic> json) {
|
|
final membersRaw = (json['EmployeePolicy'] as List?) ?? const [];
|
|
return ChatbotPolicy(
|
|
clientPolicyId: (json['client_policy_id'] ?? '').toString(),
|
|
policyName: (json['heading'] ?? 'Unnamed Policy').toString(),
|
|
policyType:
|
|
(json['policy_type'] ?? json['policy_type_long_name'] ?? '').toString(),
|
|
eCardDownloadUrl: (json['eCardDownload'] ?? '').toString(),
|
|
networkHospitalsUrl: (json['network_hospitals_url'] ?? '').toString(),
|
|
members: membersRaw
|
|
.whereType<Map>()
|
|
.map((item) => PolicyMember.fromJson(Map<String, dynamic>.from(item)))
|
|
.toList(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ClaimStatusItem {
|
|
final String claimNumber;
|
|
final String status;
|
|
final String amount;
|
|
final String date;
|
|
|
|
const ClaimStatusItem({
|
|
required this.claimNumber,
|
|
required this.status,
|
|
required this.amount,
|
|
required this.date,
|
|
});
|
|
|
|
factory ClaimStatusItem.fromJson(Map<String, dynamic> json) {
|
|
return ClaimStatusItem(
|
|
claimNumber: (json['claim_no'] ?? json['ticket_id'] ?? json['id'] ?? '-')
|
|
.toString(),
|
|
status: (json['claim_status'] ?? json['status'] ?? 'Pending').toString(),
|
|
amount: (json['claim_amount'] ?? json['amount'] ?? '0').toString(),
|
|
date: (json['created_at'] ?? json['date'] ?? '-').toString(),
|
|
);
|
|
}
|
|
}
|
|
|
|
enum ChatbotFlowStep {
|
|
rootMenu,
|
|
policyList,
|
|
policyActions,
|
|
memberList,
|
|
claimStatusList,
|
|
helpMenu,
|
|
}
|
|
|
|
class ChatbotMessage {
|
|
final String text;
|
|
final bool isBot;
|
|
final DateTime createdAt;
|
|
|
|
const ChatbotMessage({
|
|
required this.text,
|
|
required this.isBot,
|
|
required this.createdAt,
|
|
});
|
|
}
|
|
|
|
class ChatbotOption {
|
|
final String id;
|
|
final String label;
|
|
|
|
const ChatbotOption({
|
|
required this.id,
|
|
required this.label,
|
|
});
|
|
}
|