part of 'generated.dart';

class UpdateCourseVariablesBuilder {
  String id;
  Optional<String> _title = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _description = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _thumbnailUrl = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _durationMinutes = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _xpReward = Optional.optional(nativeFromJson, nativeToJson);
  String categoryId;
  Optional<String> _levelRequired = Optional.optional(nativeFromJson, nativeToJson);
  Optional<bool> _isCertification = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;  UpdateCourseVariablesBuilder title(String? t) {
   _title.value = t;
   return this;
  }
  UpdateCourseVariablesBuilder description(String? t) {
   _description.value = t;
   return this;
  }
  UpdateCourseVariablesBuilder thumbnailUrl(String? t) {
   _thumbnailUrl.value = t;
   return this;
  }
  UpdateCourseVariablesBuilder durationMinutes(int? t) {
   _durationMinutes.value = t;
   return this;
  }
  UpdateCourseVariablesBuilder xpReward(int? t) {
   _xpReward.value = t;
   return this;
  }
  UpdateCourseVariablesBuilder levelRequired(String? t) {
   _levelRequired.value = t;
   return this;
  }
  UpdateCourseVariablesBuilder isCertification(bool? t) {
   _isCertification.value = t;
   return this;
  }

  UpdateCourseVariablesBuilder(this._dataConnect, {required  this.id,required  this.categoryId,});
  Deserializer<UpdateCourseData> dataDeserializer = (dynamic json)  => UpdateCourseData.fromJson(jsonDecode(json));
  Serializer<UpdateCourseVariables> varsSerializer = (UpdateCourseVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<UpdateCourseData, UpdateCourseVariables>> execute() {
    return ref().execute();
  }

  MutationRef<UpdateCourseData, UpdateCourseVariables> ref() {
    UpdateCourseVariables vars= UpdateCourseVariables(id: id,title: _title,description: _description,thumbnailUrl: _thumbnailUrl,durationMinutes: _durationMinutes,xpReward: _xpReward,categoryId: categoryId,levelRequired: _levelRequired,isCertification: _isCertification,);
    return _dataConnect.mutation("updateCourse", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class UpdateCourseCourseUpdate {
  final String id;
  UpdateCourseCourseUpdate.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateCourseCourseUpdate otherTyped = other as UpdateCourseCourseUpdate;
    return id == otherTyped.id;
    
  }
  @override
  int get hashCode => id.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    return json;
  }

  UpdateCourseCourseUpdate({
    required this.id,
  });
}

@immutable
class UpdateCourseData {
  final UpdateCourseCourseUpdate? course_update;
  UpdateCourseData.fromJson(dynamic json):
  
  course_update = json['course_update'] == null ? null : UpdateCourseCourseUpdate.fromJson(json['course_update']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateCourseData otherTyped = other as UpdateCourseData;
    return course_update == otherTyped.course_update;
    
  }
  @override
  int get hashCode => course_update.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    if (course_update != null) {
      json['course_update'] = course_update!.toJson();
    }
    return json;
  }

  UpdateCourseData({
    this.course_update,
  });
}

@immutable
class UpdateCourseVariables {
  final String id;
  late final Optional<String>title;
  late final Optional<String>description;
  late final Optional<String>thumbnailUrl;
  late final Optional<int>durationMinutes;
  late final Optional<int>xpReward;
  final String categoryId;
  late final Optional<String>levelRequired;
  late final Optional<bool>isCertification;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  UpdateCourseVariables.fromJson(Map<String, dynamic> json):
  
  id = nativeFromJson<String>(json['id']),
  categoryId = nativeFromJson<String>(json['categoryId']) {
  
  
  
    title = Optional.optional(nativeFromJson, nativeToJson);
    title.value = json['title'] == null ? null : nativeFromJson<String>(json['title']);
  
  
    description = Optional.optional(nativeFromJson, nativeToJson);
    description.value = json['description'] == null ? null : nativeFromJson<String>(json['description']);
  
  
    thumbnailUrl = Optional.optional(nativeFromJson, nativeToJson);
    thumbnailUrl.value = json['thumbnailUrl'] == null ? null : nativeFromJson<String>(json['thumbnailUrl']);
  
  
    durationMinutes = Optional.optional(nativeFromJson, nativeToJson);
    durationMinutes.value = json['durationMinutes'] == null ? null : nativeFromJson<int>(json['durationMinutes']);
  
  
    xpReward = Optional.optional(nativeFromJson, nativeToJson);
    xpReward.value = json['xpReward'] == null ? null : nativeFromJson<int>(json['xpReward']);
  
  
  
    levelRequired = Optional.optional(nativeFromJson, nativeToJson);
    levelRequired.value = json['levelRequired'] == null ? null : nativeFromJson<String>(json['levelRequired']);
  
  
    isCertification = Optional.optional(nativeFromJson, nativeToJson);
    isCertification.value = json['isCertification'] == null ? null : nativeFromJson<bool>(json['isCertification']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateCourseVariables otherTyped = other as UpdateCourseVariables;
    return id == otherTyped.id && 
    title == otherTyped.title && 
    description == otherTyped.description && 
    thumbnailUrl == otherTyped.thumbnailUrl && 
    durationMinutes == otherTyped.durationMinutes && 
    xpReward == otherTyped.xpReward && 
    categoryId == otherTyped.categoryId && 
    levelRequired == otherTyped.levelRequired && 
    isCertification == otherTyped.isCertification;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, title.hashCode, description.hashCode, thumbnailUrl.hashCode, durationMinutes.hashCode, xpReward.hashCode, categoryId.hashCode, levelRequired.hashCode, isCertification.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    if(title.state == OptionalState.set) {
      json['title'] = title.toJson();
    }
    if(description.state == OptionalState.set) {
      json['description'] = description.toJson();
    }
    if(thumbnailUrl.state == OptionalState.set) {
      json['thumbnailUrl'] = thumbnailUrl.toJson();
    }
    if(durationMinutes.state == OptionalState.set) {
      json['durationMinutes'] = durationMinutes.toJson();
    }
    if(xpReward.state == OptionalState.set) {
      json['xpReward'] = xpReward.toJson();
    }
    json['categoryId'] = nativeToJson<String>(categoryId);
    if(levelRequired.state == OptionalState.set) {
      json['levelRequired'] = levelRequired.toJson();
    }
    if(isCertification.state == OptionalState.set) {
      json['isCertification'] = isCertification.toJson();
    }
    return json;
  }

  UpdateCourseVariables({
    required this.id,
    required this.title,
    required this.description,
    required this.thumbnailUrl,
    required this.durationMinutes,
    required this.xpReward,
    required this.categoryId,
    required this.levelRequired,
    required this.isCertification,
  });
}

