import 'package:equatable/equatable.dart'; import 'package:travel_mate/models/account.dart'; import 'package:travel_mate/models/group_member.dart'; /// Abstract base class for account-related events in the BLoC pattern. /// /// This class extends [Equatable] to enable value comparison for events. /// All account events should inherit from this class and implement the [props] getter. abstract class AccountEvent extends Equatable { const AccountEvent(); @override List get props => []; } /// Event to load accounts associated with a specific user ID. /// /// This event is dispatched when the application needs to fetch accounts /// for a given user, typically for displaying user-specific account data. class LoadAccountsByUserId extends AccountEvent { final String userId; const LoadAccountsByUserId(this.userId); @override List get props => [userId]; } /// Event to load accounts associated with a specific trip. /// /// This event is dispatched when the application needs to fetch accounts /// related to a particular trip, such as for trip expense management. class LoadAccountsByTrip extends AccountEvent { final String tripId; const LoadAccountsByTrip(this.tripId); @override List get props => [tripId]; } /// Event to create a new account. /// /// This event is dispatched when a new account needs to be created, /// passing the [Account] object containing the account details. class CreateAccount extends AccountEvent { final Account account; const CreateAccount(this.account); @override List get props => [account]; } /// Event to update an existing account. /// /// This event is dispatched when an account needs to be modified, /// requiring the [accountId] to identify the account and the updated [Account] object. class UpdateAccount extends AccountEvent { final String accountId; final Account account; const UpdateAccount({ required this.accountId, required this.account, }); @override List get props => [accountId, account]; } /// Event to create a new account along with its group members. /// /// This event is dispatched when creating an account that includes /// a list of [GroupMember] objects, such as for shared trip accounts. class CreateAccountWithMembers extends AccountEvent { final Account account; final List members; const CreateAccountWithMembers({ required this.account, required this.members, }); @override List get props => [account, members]; } /// Event to add a member to an existing account. /// /// This event is dispatched when a new member needs to be added to /// an account, typically when editing a trip and adding new participants. class AddMemberToAccount extends AccountEvent { final String accountId; final GroupMember member; const AddMemberToAccount(this.accountId, this.member); @override List get props => [accountId, member]; } /// Event to remove a member from an existing account. /// /// This event is dispatched when a member needs to be removed from /// an account, typically when editing a trip and removing participants. class RemoveMemberFromAccount extends AccountEvent { final String accountId; final String memberId; const RemoveMemberFromAccount(this.accountId, this.memberId); @override List get props => [accountId, memberId]; }