part of 'generated.dart';

class CreateStaffCourseVariablesBuilder {
  String staffId;
  String courseId;
  Optional<int> _progressPercent = Optional.optional(nativeFromJson, nativeToJson);
  Optional<bool> _completed = Optional.optional(nativeFromJson, nativeToJson);
  Optional<Timestamp> _completedAt = Optional.optional((json) => json['completedAt'] = Timestamp.fromJson(json['completedAt']), defaultSerializer);
  Optional<Timestamp> _startedAt = Optional.optional((json) => json['startedAt'] = Timestamp.fromJson(json['startedAt']), defaultSerializer);
  Optional<Timestamp> _lastAccessedAt = Optional.optional((json) => json['lastAccessedAt'] = Timestamp.fromJson(json['lastAccessedAt']), defaultSerializer);

  final FirebaseDataConnect _dataConnect;  CreateStaffCourseVariablesBuilder progressPercent(int? t) {
   _progressPercent.value = t;
   return this;
  }
  CreateStaffCourseVariablesBuilder completed(bool? t) {
   _completed.value = t;
   return this;
  }
  CreateStaffCourseVariablesBuilder completedAt(Timestamp? t) {
   _completedAt.value = t;
   return this;
  }
  CreateStaffCourseVariablesBuilder startedAt(Timestamp? t) {
   _startedAt.value = t;
   return this;
  }
  CreateStaffCourseVariablesBuilder lastAccessedAt(Timestamp? t) {
   _lastAccessedAt.value = t;
   return this;
  }

  CreateStaffCourseVariablesBuilder(this._dataConnect, {required  this.staffId,required  this.courseId,});
  Deserializer<CreateStaffCourseData> dataDeserializer = (dynamic json)  => CreateStaffCourseData.fromJson(jsonDecode(json));
  Serializer<CreateStaffCourseVariables> varsSerializer = (CreateStaffCourseVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<CreateStaffCourseData, CreateStaffCourseVariables>> execute() {
    return ref().execute();
  }

  MutationRef<CreateStaffCourseData, CreateStaffCourseVariables> ref() {
    CreateStaffCourseVariables vars= CreateStaffCourseVariables(staffId: staffId,courseId: courseId,progressPercent: _progressPercent,completed: _completed,completedAt: _completedAt,startedAt: _startedAt,lastAccessedAt: _lastAccessedAt,);
    return _dataConnect.mutation("createStaffCourse", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final CreateStaffCourseData otherTyped = other as CreateStaffCourseData;
    return staffCourse_insert == otherTyped.staffCourse_insert;
    
  }
  @override
  int get hashCode => staffCourse_insert.hashCode;
  

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

  CreateStaffCourseData({
    required this.staffCourse_insert,
  });
}

@immutable
class CreateStaffCourseVariables {
  final String staffId;
  final String courseId;
  late final Optional<int>progressPercent;
  late final Optional<bool>completed;
  late final Optional<Timestamp>completedAt;
  late final Optional<Timestamp>startedAt;
  late final Optional<Timestamp>lastAccessedAt;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  CreateStaffCourseVariables.fromJson(Map<String, dynamic> json):
  
  staffId = nativeFromJson<String>(json['staffId']),
  courseId = nativeFromJson<String>(json['courseId']) {
  
  
  
  
    progressPercent = Optional.optional(nativeFromJson, nativeToJson);
    progressPercent.value = json['progressPercent'] == null ? null : nativeFromJson<int>(json['progressPercent']);
  
  
    completed = Optional.optional(nativeFromJson, nativeToJson);
    completed.value = json['completed'] == null ? null : nativeFromJson<bool>(json['completed']);
  
  
    completedAt = Optional.optional((json) => json['completedAt'] = Timestamp.fromJson(json['completedAt']), defaultSerializer);
    completedAt.value = json['completedAt'] == null ? null : Timestamp.fromJson(json['completedAt']);
  
  
    startedAt = Optional.optional((json) => json['startedAt'] = Timestamp.fromJson(json['startedAt']), defaultSerializer);
    startedAt.value = json['startedAt'] == null ? null : Timestamp.fromJson(json['startedAt']);
  
  
    lastAccessedAt = Optional.optional((json) => json['lastAccessedAt'] = Timestamp.fromJson(json['lastAccessedAt']), defaultSerializer);
    lastAccessedAt.value = json['lastAccessedAt'] == null ? null : Timestamp.fromJson(json['lastAccessedAt']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final CreateStaffCourseVariables otherTyped = other as CreateStaffCourseVariables;
    return staffId == otherTyped.staffId && 
    courseId == otherTyped.courseId && 
    progressPercent == otherTyped.progressPercent && 
    completed == otherTyped.completed && 
    completedAt == otherTyped.completedAt && 
    startedAt == otherTyped.startedAt && 
    lastAccessedAt == otherTyped.lastAccessedAt;
    
  }
  @override
  int get hashCode => Object.hashAll([staffId.hashCode, courseId.hashCode, progressPercent.hashCode, completed.hashCode, completedAt.hashCode, startedAt.hashCode, lastAccessedAt.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['staffId'] = nativeToJson<String>(staffId);
    json['courseId'] = nativeToJson<String>(courseId);
    if(progressPercent.state == OptionalState.set) {
      json['progressPercent'] = progressPercent.toJson();
    }
    if(completed.state == OptionalState.set) {
      json['completed'] = completed.toJson();
    }
    if(completedAt.state == OptionalState.set) {
      json['completedAt'] = completedAt.toJson();
    }
    if(startedAt.state == OptionalState.set) {
      json['startedAt'] = startedAt.toJson();
    }
    if(lastAccessedAt.state == OptionalState.set) {
      json['lastAccessedAt'] = lastAccessedAt.toJson();
    }
    return json;
  }

  CreateStaffCourseVariables({
    required this.staffId,
    required this.courseId,
    required this.progressPercent,
    required this.completed,
    required this.completedAt,
    required this.startedAt,
    required this.lastAccessedAt,
  });
}

