part of 'generated.dart';

class CreateTaskVariablesBuilder {
  String taskName;
  Optional<String> _description = Optional.optional(nativeFromJson, nativeToJson);
  TaskPriority priority;
  TaskStatus status;
  Optional<Timestamp> _dueDate = Optional.optional((json) => json['dueDate'] = Timestamp.fromJson(json['dueDate']), defaultSerializer);
  Optional<int> _progress = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _orderIndex = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _commentCount = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _attachmentCount = Optional.optional(nativeFromJson, nativeToJson);
  Optional<AnyValue> _files = Optional.optional(AnyValue.fromJson, defaultSerializer);
  String ownerId;

  final FirebaseDataConnect _dataConnect;  CreateTaskVariablesBuilder description(String? t) {
   _description.value = t;
   return this;
  }
  CreateTaskVariablesBuilder dueDate(Timestamp? t) {
   _dueDate.value = t;
   return this;
  }
  CreateTaskVariablesBuilder progress(int? t) {
   _progress.value = t;
   return this;
  }
  CreateTaskVariablesBuilder orderIndex(int? t) {
   _orderIndex.value = t;
   return this;
  }
  CreateTaskVariablesBuilder commentCount(int? t) {
   _commentCount.value = t;
   return this;
  }
  CreateTaskVariablesBuilder attachmentCount(int? t) {
   _attachmentCount.value = t;
   return this;
  }
  CreateTaskVariablesBuilder files(AnyValue? t) {
   _files.value = t;
   return this;
  }

  CreateTaskVariablesBuilder(this._dataConnect, {required  this.taskName,required  this.priority,required  this.status,required  this.ownerId,});
  Deserializer<CreateTaskData> dataDeserializer = (dynamic json)  => CreateTaskData.fromJson(jsonDecode(json));
  Serializer<CreateTaskVariables> varsSerializer = (CreateTaskVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<CreateTaskData, CreateTaskVariables>> execute() {
    return ref().execute();
  }

  MutationRef<CreateTaskData, CreateTaskVariables> ref() {
    CreateTaskVariables vars= CreateTaskVariables(taskName: taskName,description: _description,priority: priority,status: status,dueDate: _dueDate,progress: _progress,orderIndex: _orderIndex,commentCount: _commentCount,attachmentCount: _attachmentCount,files: _files,ownerId: ownerId,);
    return _dataConnect.mutation("createTask", dataDeserializer, varsSerializer, vars);
  }
}

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

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

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

    final CreateTaskData otherTyped = other as CreateTaskData;
    return task_insert == otherTyped.task_insert;
    
  }
  @override
  int get hashCode => task_insert.hashCode;
  

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

  CreateTaskData({
    required this.task_insert,
  });
}

@immutable
class CreateTaskVariables {
  final String taskName;
  late final Optional<String>description;
  final TaskPriority priority;
  final TaskStatus status;
  late final Optional<Timestamp>dueDate;
  late final Optional<int>progress;
  late final Optional<int>orderIndex;
  late final Optional<int>commentCount;
  late final Optional<int>attachmentCount;
  late final Optional<AnyValue>files;
  final String ownerId;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  CreateTaskVariables.fromJson(Map<String, dynamic> json):
  
  taskName = nativeFromJson<String>(json['taskName']),
  priority = TaskPriority.values.byName(json['priority']),
  status = TaskStatus.values.byName(json['status']),
  ownerId = nativeFromJson<String>(json['ownerId']) {
  
  
  
    description = Optional.optional(nativeFromJson, nativeToJson);
    description.value = json['description'] == null ? null : nativeFromJson<String>(json['description']);
  
  
  
  
    dueDate = Optional.optional((json) => json['dueDate'] = Timestamp.fromJson(json['dueDate']), defaultSerializer);
    dueDate.value = json['dueDate'] == null ? null : Timestamp.fromJson(json['dueDate']);
  
  
    progress = Optional.optional(nativeFromJson, nativeToJson);
    progress.value = json['progress'] == null ? null : nativeFromJson<int>(json['progress']);
  
  
    orderIndex = Optional.optional(nativeFromJson, nativeToJson);
    orderIndex.value = json['orderIndex'] == null ? null : nativeFromJson<int>(json['orderIndex']);
  
  
    commentCount = Optional.optional(nativeFromJson, nativeToJson);
    commentCount.value = json['commentCount'] == null ? null : nativeFromJson<int>(json['commentCount']);
  
  
    attachmentCount = Optional.optional(nativeFromJson, nativeToJson);
    attachmentCount.value = json['attachmentCount'] == null ? null : nativeFromJson<int>(json['attachmentCount']);
  
  
    files = Optional.optional(AnyValue.fromJson, defaultSerializer);
    files.value = json['files'] == null ? null : AnyValue.fromJson(json['files']);
  
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final CreateTaskVariables otherTyped = other as CreateTaskVariables;
    return taskName == otherTyped.taskName && 
    description == otherTyped.description && 
    priority == otherTyped.priority && 
    status == otherTyped.status && 
    dueDate == otherTyped.dueDate && 
    progress == otherTyped.progress && 
    orderIndex == otherTyped.orderIndex && 
    commentCount == otherTyped.commentCount && 
    attachmentCount == otherTyped.attachmentCount && 
    files == otherTyped.files && 
    ownerId == otherTyped.ownerId;
    
  }
  @override
  int get hashCode => Object.hashAll([taskName.hashCode, description.hashCode, priority.hashCode, status.hashCode, dueDate.hashCode, progress.hashCode, orderIndex.hashCode, commentCount.hashCode, attachmentCount.hashCode, files.hashCode, ownerId.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['taskName'] = nativeToJson<String>(taskName);
    if(description.state == OptionalState.set) {
      json['description'] = description.toJson();
    }
    json['priority'] = 
    priority.name
    ;
    json['status'] = 
    status.name
    ;
    if(dueDate.state == OptionalState.set) {
      json['dueDate'] = dueDate.toJson();
    }
    if(progress.state == OptionalState.set) {
      json['progress'] = progress.toJson();
    }
    if(orderIndex.state == OptionalState.set) {
      json['orderIndex'] = orderIndex.toJson();
    }
    if(commentCount.state == OptionalState.set) {
      json['commentCount'] = commentCount.toJson();
    }
    if(attachmentCount.state == OptionalState.set) {
      json['attachmentCount'] = attachmentCount.toJson();
    }
    if(files.state == OptionalState.set) {
      json['files'] = files.toJson();
    }
    json['ownerId'] = nativeToJson<String>(ownerId);
    return json;
  }

  CreateTaskVariables({
    required this.taskName,
    required this.description,
    required this.priority,
    required this.status,
    required this.dueDate,
    required this.progress,
    required this.orderIndex,
    required this.commentCount,
    required this.attachmentCount,
    required this.files,
    required this.ownerId,
  });
}

