import 'package:json_annotation/json_annotation.dart';
import 'package:krow/features/shifts/data/models/cancellation_reason.dart';
import 'package:krow/features/shifts/data/models/position.dart';

part 'staff_shift.g.dart';

@JsonEnum(fieldRename: FieldRename.snake)
enum EventShiftRoleStaffStatus {
  assigned,
  confirmed,
  ongoing,
  completed,
  canceledByStaff,
  canceledByBusiness,
  canceledByAdmin,
  requestedReplace,
  declineByStaff,
}

@JsonSerializable(fieldRename: FieldRename.snake)
class StaffShift {
  String id;
  DateTime? statusUpdatedAt;
  EventShiftRoleStaffStatus status;
  Position? position;
  DateTime? startAt;
  DateTime? endAt;
  DateTime? clockIn;
  DateTime? clockOut;
  DateTime? breakIn;
  DateTime? breakOut;
  List<CancellationReasonModel>? cancelReason;
  StaffRating? rating;


  // Staff? staff;

  StaffShift({
    required this.id,
    required this.status,
    this.statusUpdatedAt,
    this.position,
    this.startAt,
    this.endAt,
    this.clockIn,
    this.clockOut,
    this.breakIn,
    this.breakOut,
    this.rating,
    // this.staff
  });

  factory StaffShift.fromJson(Map<String, dynamic> json) {
    return _$StaffShiftFromJson(json);
  }

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

@JsonSerializable(fieldRename: FieldRename.snake)
class StaffRating{
  final String id;
  final double rating;

  factory StaffRating.fromJson(Map<String, dynamic> json) {
      return _$StaffRatingFromJson(json);
    }

  StaffRating({required this.id, required this.rating});

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

}
