part of 'generated.dart';

class CreateCourseVariablesBuilder {
  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;
  CreateCourseVariablesBuilder title(String? t) {
   _title.value = t;
   return this;
  }
  CreateCourseVariablesBuilder description(String? t) {
   _description.value = t;
   return this;
  }
  CreateCourseVariablesBuilder thumbnailUrl(String? t) {
   _thumbnailUrl.value = t;
   return this;
  }
  CreateCourseVariablesBuilder durationMinutes(int? t) {
   _durationMinutes.value = t;
   return this;
  }
  CreateCourseVariablesBuilder xpReward(int? t) {
   _xpReward.value = t;
   return this;
  }
  CreateCourseVariablesBuilder levelRequired(String? t) {
   _levelRequired.value = t;
   return this;
  }
  CreateCourseVariablesBuilder isCertification(bool? t) {
   _isCertification.value = t;
   return this;
  }

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

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

@immutable
class CreateCourseCourseInsert {
  final String id;
  CreateCourseCourseInsert.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 CreateCourseCourseInsert otherTyped = other as CreateCourseCourseInsert;
    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;
  }

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

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

    final CreateCourseData otherTyped = other as CreateCourseData;
    return course_insert == otherTyped.course_insert;
    
  }
  @override
  int get hashCode => course_insert.hashCode;
  

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

  CreateCourseData({
    required this.course_insert,
  });
}

@immutable
class CreateCourseVariables {
  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.')
  CreateCourseVariables.fromJson(Map<String, dynamic> json):
  
  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 CreateCourseVariables otherTyped = other as CreateCourseVariables;
    return 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([title.hashCode, description.hashCode, thumbnailUrl.hashCode, durationMinutes.hashCode, xpReward.hashCode, categoryId.hashCode, levelRequired.hashCode, isCertification.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    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;
  }

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

