import 'package:hive_ce/hive.dart'; import 'package:worker/core/constants/storage_constants.dart'; part 'enums.g.dart'; // ============================================================================ // USER ENUMS // ============================================================================ /// User Role /// /// Represents the role of a user in the system. @HiveType(typeId: HiveTypeIds.userRole) enum UserRole { @HiveField(0) customer, @HiveField(1) distributor, @HiveField(2) admin, @HiveField(3) staff, } /// User Status /// /// Represents the account status of a user. @HiveType(typeId: HiveTypeIds.userStatus) enum UserStatus { @HiveField(0) active, @HiveField(1) inactive, @HiveField(2) suspended, @HiveField(3) pending, } /// Loyalty Tier Levels /// /// Represents the loyalty program membership tiers. /// Higher tiers receive more benefits and rewards. @HiveType(typeId: HiveTypeIds.loyaltyTier) enum LoyaltyTier { @HiveField(0) bronze, @HiveField(1) silver, @HiveField(2) gold, @HiveField(3) platinum, @HiveField(4) diamond, @HiveField(5) titan, } // ============================================================================ // ORDER ENUMS // ============================================================================ /// Order Status /// /// Represents the current state of an order. @HiveType(typeId: HiveTypeIds.orderStatus) enum OrderStatus { @HiveField(0) draft, @HiveField(1) pending, @HiveField(2) confirmed, @HiveField(3) processing, @HiveField(4) shipped, @HiveField(5) delivered, @HiveField(6) completed, @HiveField(7) cancelled, @HiveField(8) refunded, } // ============================================================================ // INVOICE & PAYMENT ENUMS // ============================================================================ /// Invoice Type /// /// Represents the type of invoice. @HiveType(typeId: HiveTypeIds.invoiceType) enum InvoiceType { @HiveField(0) sales, @HiveField(1) proforma, @HiveField(2) creditNote, @HiveField(3) debitNote, } /// Invoice Status /// /// Represents the payment status of an invoice. @HiveType(typeId: HiveTypeIds.invoiceStatus) enum InvoiceStatus { @HiveField(0) draft, @HiveField(1) issued, @HiveField(2) partiallyPaid, @HiveField(3) paid, @HiveField(4) overdue, @HiveField(5) cancelled, @HiveField(6) refunded, } /// Payment Method /// /// Represents available payment methods. @HiveType(typeId: HiveTypeIds.paymentMethod) enum PaymentMethod { @HiveField(0) cash, @HiveField(1) bankTransfer, @HiveField(2) creditCard, @HiveField(3) debitCard, @HiveField(4) eWallet, @HiveField(5) cheque, @HiveField(6) creditTerm, } /// Payment Status /// /// Represents the status of a payment transaction. @HiveType(typeId: HiveTypeIds.paymentStatus) enum PaymentStatus { @HiveField(0) pending, @HiveField(1) processing, @HiveField(2) completed, @HiveField(3) failed, @HiveField(4) refunded, @HiveField(5) cancelled, } // ============================================================================ // LOYALTY ENUMS // ============================================================================ /// Entry Type /// /// Represents the type of loyalty points entry. @HiveType(typeId: HiveTypeIds.entryType) enum EntryType { @HiveField(0) earn, @HiveField(1) redeem, @HiveField(2) adjustment, @HiveField(3) expiry, @HiveField(4) refund, } /// Entry Source /// /// Represents the source of a loyalty points entry. @HiveType(typeId: HiveTypeIds.entrySource) enum EntrySource { @HiveField(0) purchase, @HiveField(1) referral, @HiveField(2) promotion, @HiveField(3) bonus, @HiveField(4) giftRedemption, @HiveField(5) projectSubmission, @HiveField(6) pointsRecord, @HiveField(7) manualAdjustment, } /// Complaint Status /// /// Represents the status of a complaint. @HiveType(typeId: HiveTypeIds.complaintStatus) enum ComplaintStatus { @HiveField(0) none, @HiveField(1) pending, @HiveField(2) investigating, @HiveField(3) resolved, @HiveField(4) rejected, } /// Gift Category /// /// Represents the category of a gift. @HiveType(typeId: HiveTypeIds.giftCategory) enum GiftCategory { @HiveField(0) voucher, @HiveField(1) product, @HiveField(2) service, @HiveField(3) discount, @HiveField(4) experience, } /// Gift Status /// /// Represents the status of a redeemed gift. @HiveType(typeId: HiveTypeIds.giftStatus) enum GiftStatus { @HiveField(0) active, @HiveField(1) used, @HiveField(2) expired, @HiveField(3) cancelled, } /// Points Record Status /// /// Represents the status of a points record submission. @HiveType(typeId: HiveTypeIds.pointsStatus) enum PointsStatus { @HiveField(0) pending, @HiveField(1) approved, @HiveField(2) rejected, } // ============================================================================ // PROJECT ENUMS // ============================================================================ /// Project Type /// /// Represents the category of construction project. @HiveType(typeId: HiveTypeIds.projectType) enum ProjectType { @HiveField(0) residential, @HiveField(1) commercial, @HiveField(2) industrial, @HiveField(3) infrastructure, @HiveField(4) renovation, @HiveField(5) interior, @HiveField(6) exterior, } /// Submission Status /// /// Represents the status of a project submission. @HiveType(typeId: HiveTypeIds.submissionStatus) enum SubmissionStatus { @HiveField(0) pending, @HiveField(1) reviewing, @HiveField(2) approved, @HiveField(3) rejected, @HiveField(4) needsRevision, } /// Design Status /// /// Represents the status of a design request. @HiveType(typeId: HiveTypeIds.designStatus) enum DesignStatus { @HiveField(0) pending, @HiveField(1) assigned, @HiveField(2) inProgress, @HiveField(3) reviewing, @HiveField(4) completed, @HiveField(5) cancelled, @HiveField(6) onHold, } // ============================================================================ // QUOTE ENUMS // ============================================================================ /// Quote Status /// /// Represents the status of a quotation. @HiveType(typeId: HiveTypeIds.quoteStatus) enum QuoteStatus { @HiveField(0) draft, @HiveField(1) sent, @HiveField(2) viewed, @HiveField(3) accepted, @HiveField(4) rejected, @HiveField(5) expired, @HiveField(6) converted, @HiveField(7) cancelled, } // ============================================================================ // CHAT ENUMS // ============================================================================ /// Room Type /// /// Represents the type of chat room. @HiveType(typeId: HiveTypeIds.roomType) enum RoomType { @HiveField(0) support, @HiveField(1) sales, @HiveField(2) orderInquiry, @HiveField(3) quoteDiscussion, @HiveField(4) general, } /// Content Type /// /// Represents the type of message content. @HiveType(typeId: HiveTypeIds.contentType) enum ContentType { @HiveField(0) text, @HiveField(1) image, @HiveField(2) file, @HiveField(3) video, @HiveField(4) audio, @HiveField(5) productReference, @HiveField(6) orderReference, @HiveField(7) quoteReference, } // ============================================================================ // NOTIFICATION ENUMS // ============================================================================ /// Reminder Type /// /// Represents the type of payment reminder. @HiveType(typeId: HiveTypeIds.reminderType) enum ReminderType { @HiveField(0) beforeDue, @HiveField(1) dueDate, @HiveField(2) overdue, @HiveField(3) finalNotice, } // ============================================================================ // EXTENSION METHODS // ============================================================================ extension UserRoleExtension on UserRole { String get displayName { switch (this) { case UserRole.customer: return 'Khách hàng'; case UserRole.distributor: return 'Đại lý'; case UserRole.admin: return 'Quản trị viên'; case UserRole.staff: return 'Nhân viên'; } } } extension UserStatusExtension on UserStatus { String get displayName { switch (this) { case UserStatus.active: return 'Hoạt động'; case UserStatus.inactive: return 'Không hoạt động'; case UserStatus.suspended: return 'Tạm khóa'; case UserStatus.pending: return 'Chờ duyệt'; } } } extension LoyaltyTierExtension on LoyaltyTier { String get displayName { switch (this) { case LoyaltyTier.bronze: return 'Đồng'; case LoyaltyTier.silver: return 'Bạc'; case LoyaltyTier.gold: return 'Vàng'; case LoyaltyTier.platinum: return 'Bạch kim'; case LoyaltyTier.diamond: return 'Kim cương'; case LoyaltyTier.titan: return 'Titan'; } } int get level { switch (this) { case LoyaltyTier.bronze: return 1; case LoyaltyTier.silver: return 2; case LoyaltyTier.gold: return 3; case LoyaltyTier.platinum: return 4; case LoyaltyTier.diamond: return 5; case LoyaltyTier.titan: return 6; } } } extension OrderStatusExtension on OrderStatus { String get displayName { switch (this) { case OrderStatus.draft: return 'Nháp'; case OrderStatus.pending: return 'Chờ xác nhận'; case OrderStatus.confirmed: return 'Đã xác nhận'; case OrderStatus.processing: return 'Đang xử lý'; case OrderStatus.shipped: return 'Đang giao hàng'; case OrderStatus.delivered: return 'Đã giao hàng'; case OrderStatus.completed: return 'Hoàn thành'; case OrderStatus.cancelled: return 'Đã hủy'; case OrderStatus.refunded: return 'Đã hoàn tiền'; } } bool get isActive { return this == OrderStatus.pending || this == OrderStatus.confirmed || this == OrderStatus.processing || this == OrderStatus.shipped; } bool get isFinal { return this == OrderStatus.completed || this == OrderStatus.cancelled || this == OrderStatus.refunded; } } extension InvoiceStatusExtension on InvoiceStatus { String get displayName { switch (this) { case InvoiceStatus.draft: return 'Nháp'; case InvoiceStatus.issued: return 'Đã phát hành'; case InvoiceStatus.partiallyPaid: return 'Thanh toán 1 phần'; case InvoiceStatus.paid: return 'Đã thanh toán'; case InvoiceStatus.overdue: return 'Quá hạn'; case InvoiceStatus.cancelled: return 'Đã hủy'; case InvoiceStatus.refunded: return 'Đã hoàn tiền'; } } } extension PaymentMethodExtension on PaymentMethod { String get displayName { switch (this) { case PaymentMethod.cash: return 'Tiền mặt'; case PaymentMethod.bankTransfer: return 'Chuyển khoản'; case PaymentMethod.creditCard: return 'Thẻ tín dụng'; case PaymentMethod.debitCard: return 'Thẻ ghi nợ'; case PaymentMethod.eWallet: return 'Ví điện tử'; case PaymentMethod.cheque: return 'Séc'; case PaymentMethod.creditTerm: return 'Công nợ'; } } } extension PaymentStatusExtension on PaymentStatus { String get displayName { switch (this) { case PaymentStatus.pending: return 'Chờ xử lý'; case PaymentStatus.processing: return 'Đang xử lý'; case PaymentStatus.completed: return 'Hoàn thành'; case PaymentStatus.failed: return 'Thất bại'; case PaymentStatus.refunded: return 'Đã hoàn tiền'; case PaymentStatus.cancelled: return 'Đã hủy'; } } } extension EntryTypeExtension on EntryType { String get displayName { switch (this) { case EntryType.earn: return 'Tích điểm'; case EntryType.redeem: return 'Đổi điểm'; case EntryType.adjustment: return 'Điều chỉnh'; case EntryType.expiry: return 'Hết hạn'; case EntryType.refund: return 'Hoàn điểm'; } } bool get isPositive { return this == EntryType.earn || this == EntryType.refund; } bool get isNegative { return this == EntryType.redeem || this == EntryType.expiry; } } extension EntrySourceExtension on EntrySource { String get displayName { switch (this) { case EntrySource.purchase: return 'Mua hàng'; case EntrySource.referral: return 'Giới thiệu'; case EntrySource.promotion: return 'Khuyến mãi'; case EntrySource.bonus: return 'Thưởng'; case EntrySource.giftRedemption: return 'Đổi quà'; case EntrySource.projectSubmission: return 'Nộp công trình'; case EntrySource.pointsRecord: return 'Ghi nhận điểm'; case EntrySource.manualAdjustment: return 'Điều chỉnh thủ công'; } } } extension GiftCategoryExtension on GiftCategory { String get displayName { switch (this) { case GiftCategory.voucher: return 'Phiếu quà tặng'; case GiftCategory.product: return 'Sản phẩm'; case GiftCategory.service: return 'Dịch vụ'; case GiftCategory.discount: return 'Giảm giá'; case GiftCategory.experience: return 'Trải nghiệm'; } } } extension GiftStatusExtension on GiftStatus { String get displayName { switch (this) { case GiftStatus.active: return 'Có hiệu lực'; case GiftStatus.used: return 'Đã sử dụng'; case GiftStatus.expired: return 'Hết hạn'; case GiftStatus.cancelled: return 'Đã hủy'; } } } extension ProjectTypeExtension on ProjectType { String get displayName { switch (this) { case ProjectType.residential: return 'Dân dụng'; case ProjectType.commercial: return 'Thương mại'; case ProjectType.industrial: return 'Công nghiệp'; case ProjectType.infrastructure: return 'Hạ tầng'; case ProjectType.renovation: return 'Cải tạo'; case ProjectType.interior: return 'Nội thất'; case ProjectType.exterior: return 'Ngoại thất'; } } } extension QuoteStatusExtension on QuoteStatus { String get displayName { switch (this) { case QuoteStatus.draft: return 'Nháp'; case QuoteStatus.sent: return 'Đã gửi'; case QuoteStatus.viewed: return 'Đã xem'; case QuoteStatus.accepted: return 'Chấp nhận'; case QuoteStatus.rejected: return 'Từ chối'; case QuoteStatus.expired: return 'Hết hạn'; case QuoteStatus.converted: return 'Đã chuyển đổi'; case QuoteStatus.cancelled: return 'Đã hủy'; } } bool get isActive { return this == QuoteStatus.sent || this == QuoteStatus.viewed; } bool get isFinal { return this == QuoteStatus.accepted || this == QuoteStatus.rejected || this == QuoteStatus.expired || this == QuoteStatus.converted || this == QuoteStatus.cancelled; } } extension RoomTypeExtension on RoomType { String get displayName { switch (this) { case RoomType.support: return 'Hỗ trợ'; case RoomType.sales: return 'Bán hàng'; case RoomType.orderInquiry: return 'Đơn hàng'; case RoomType.quoteDiscussion: return 'Báo giá'; case RoomType.general: return 'Chung'; } } } extension ReminderTypeExtension on ReminderType { String get displayName { switch (this) { case ReminderType.beforeDue: return 'Trước hạn'; case ReminderType.dueDate: return 'Đến hạn'; case ReminderType.overdue: return 'Quá hạn'; case ReminderType.finalNotice: return 'Thông báo cuối'; } } }