import 'package:json_annotation/json_annotation.dart';
import 'package:krow/core/data/models/staff/full_address_model.dart';
import 'package:krow/core/data/models/staff/workin_area.dart';
import 'package:krow/core/data/models/staff/bank_acc.dart';
import 'package:krow/core/data/models/staff_role.dart';
import 'package:krow/features/profile/certificates/data/models/staff_certificate.dart';

part 'staff.g.dart';

enum StaffStatus {
  active,
  deactivated,
  pending,
  registered,
  declined,
}

@JsonSerializable(fieldRename: FieldRename.snake)
class Staff {
  final String id;
  final String? firstName;
  final String? lastName;
  final String? middleName;
  final String? email;
  final String? phone;
  final String? address;
  final StaffStatus? status;
  final FullAddress? fullAddress;
  final String? avatar;
  final List<WorkingArea>? workingAreas;
  final List<BankAcc>? bankAccount;
  final List<StaffRole>? roles;
  final List<StaffCertificate>? certificates;
  final double? averageRating;

  Staff({
    required this.id,
    required this.firstName,
    required this.lastName,
    required this.middleName,
    required this.email,
    required this.phone,
    required this.address,
    required this.status,
    required this.workingAreas,
    required this.fullAddress,
    required this.bankAccount,
    required this.roles,
    required this.certificates,
    this.averageRating,
    this.avatar,
  });

  factory Staff.fromJson(Map<String, dynamic> json) => _$StaffFromJson(json);

  Map<String, dynamic> toJson() => _$StaffToJson(this);

  static var staffStatusEnumMap = {
    StaffStatus.active: 'active',
    StaffStatus.deactivated: 'deactivated',
    StaffStatus.pending: 'pending',
    StaffStatus.registered: 'registered',
    StaffStatus.declined: 'declined',
  };
}
