import 'package:injectable/injectable.dart';
import 'package:krow/core/data/models/staff_role.dart';
import 'package:krow/features/profile/role_kit/data/models/mutate_kit_dto.dart';
import 'package:krow/features/profile/role_kit/data/staff_role_kit_api.dart';
import 'package:krow/features/profile/role_kit/data/staff_role_kit_repository.dart';

enum RoleKitType {
  uniform,
  equipment,
}

@Injectable(as: StaffRoleKitRepository)
class StaffRoleKitRepositoryImpl extends StaffRoleKitRepository {
  final StaffRoleKitApiProvider _staffRoleApi;

  StaffRoleKitRepositoryImpl(this._staffRoleApi);

  @override
  Future<List<StaffRole>> getStaffRole() async {
    return _staffRoleApi.fetchStaffRoles();
  }

  @override
  Future<void> putKit(
      String skillId, List<MutateKitDto> kits, RoleKitType type) async {
    if (type == RoleKitType.uniform) {
      return _staffRoleApi.putUniform(skillId, kits);
    } else {
      return _staffRoleApi.putEquipment(skillId, kits);
    }
  }

  @override
  Future<Map<String, dynamic>> uploadImage(String imagePath) async {
    return _staffRoleApi.uploadImage(imagePath);
  }
}
