import 'package:json_annotation/json_annotation.dart';
import 'package:krow/core/data/enums/staff_skill_enums.dart';
import 'package:krow/core/data/models/skill.dart';
import 'package:krow/core/data/models/staff_role_kit.dart';

part 'staff_role.g.dart';

@JsonSerializable(fieldRename: FieldRename.snake)
class StaffRole {
  final String? id;
  final Skill? skill;
  final StaffSkillLevel? level;
  final int? experience;
  final StaffSkillStatus? status;
  final String? photo;
  final List<StaffRoleKit>? confirmedUniforms;
  final List<StaffRoleKit>? confirmedEquipments;

  StaffRole({
    this.id,
    this.skill,
    this.level,
    this.experience,
    this.status,
    this.photo,
    this.confirmedUniforms,
    this.confirmedEquipments,
  });

  factory StaffRole.empty() {
    return StaffRole(
      id: '',
    );
  }

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

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

  StaffRole copyWith({
    String? id,
    Skill? skill,
    StaffSkillLevel? level,
    int? experience,
    StaffSkillStatus? status,
    String? photo,
    List<StaffRoleKit>? confirmedUniforms,
    List<StaffRoleKit>? confirmedEquipments,
  }) {
    return StaffRole(
      id: id ?? this.id,
      skill: skill ?? this.skill,
      level: level ?? this.level,
      experience: experience ?? this.experience,
      status: status ?? this.status,
      photo: photo ?? this.photo,
      confirmedUniforms: confirmedUniforms ?? this.confirmedUniforms,
      confirmedEquipments: confirmedEquipments ?? this.confirmedEquipments,
    );
  }

  @override
  String toString() {
    return 'StaffRole{id: $id, skill: $skill, level: $level, experience: $experience, status: $status, photo: $photo, confirmedUniforms: $confirmedUniforms, confirmedEquipments: $confirmedEquipments}';
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is StaffRole &&
          runtimeType == other.runtimeType &&
          id == other.id &&
          skill == other.skill &&
          level == other.level &&
          experience == other.experience &&
          status == other.status &&
          photo == other.photo &&
          confirmedUniforms == other.confirmedUniforms &&
          confirmedEquipments == other.confirmedEquipments;

  @override
  int get hashCode =>
      id.hashCode ^
      skill.hashCode ^
      level.hashCode ^
      experience.hashCode ^
      status.hashCode ^
      photo.hashCode ^
      confirmedUniforms.hashCode ^
      confirmedEquipments.hashCode;

}
