// ignore_for_file: non_constant_identifier_names, avoid_init_to_null

import 'package:json_annotation/json_annotation.dart';
import 'package:oto/oto/data/base_data.dart';

part 'file_data.g.dart';

//Copy & Move
@JsonSerializable()
class DataCopy extends DataFile {
  DataCopy();

  late bool? isMove;
  late bool? isOverwrite = true;
  late Map<String, String> copyMap;

  factory DataCopy.fromJson(Map<String, dynamic> json) =>
      _$DataCopyFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataCopyToJson(this);
}

//Delete
@JsonSerializable()
class DataDelete extends DataFile {
  DataDelete();

  late List<String> list;

  factory DataDelete.fromJson(Map<String, dynamic> json) =>
      _$DataDeleteFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataDeleteToJson(this);
}

//Rename
@JsonSerializable()
class DataRename extends DataFile {
  DataRename();

  late Map<String, String> renameMap;

  factory DataRename.fromJson(Map<String, dynamic> json) =>
      _$DataRenameFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataRenameToJson(this);
}

//File Diff Check
@JsonSerializable()
class DataFileDiffCheck extends DataParam {
  DataFileDiffCheck();

  late List<String> paths;
  late String setDiff;

  factory DataFileDiffCheck.fromJson(Map<String, dynamic> json) =>
      _$DataFileDiffCheckFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataFileDiffCheckToJson(this);
}

//File Read
@JsonSerializable()
class DataFileRead extends DataParam {
  DataFileRead();

  late String path;
  late String setContent;

  factory DataFileRead.fromJson(Map<String, dynamic> json) =>
      _$DataFileReadFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataFileReadToJson(this);
}

//File Write
@JsonSerializable()
class DataFileWrite extends DataParam {
  DataFileWrite();

  late String path;
  late String content;
  late bool? backup;

  factory DataFileWrite.fromJson(Map<String, dynamic> json) =>
      _$DataFileWriteFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataFileWriteToJson(this);
}

//Files
@JsonSerializable()
class DataFiles extends DataParam {
  DataFiles();

  late String path;
  late bool? recursive = false;
  late List<String>? ignoreRegExs = [];
  late String setFiles;

  factory DataFiles.fromJson(Map<String, dynamic> json) =>
      _$DataFilesFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataFilesToJson(this);
}

//File Info
@JsonSerializable()
class DataFileInfo extends DataParam {
  DataFileInfo();

  late String path;
  late String setInfo;

  factory DataFileInfo.fromJson(Map<String, dynamic> json) =>
      _$DataFileInfoFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataFileInfoToJson(this);
}

//Directory Create
@JsonSerializable()
class DataDirectoryCreate extends DataParam {
  DataDirectoryCreate();

  late String path;

  factory DataDirectoryCreate.fromJson(Map<String, dynamic> json) =>
      _$DataDirectoryCreateFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataDirectoryCreateToJson(this);
}

//Zip
@JsonSerializable()
class DataZip extends DataFile {
  DataZip();

  late String zipFile;
  late List<String> zipList;

  factory DataZip.fromJson(Map<String, dynamic> json) =>
      _$DataZipFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataZipToJson(this);
}
