// 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 'git_data.g.dart';

//Git
@JsonSerializable()
class DataGit extends DataParam {
  DataGit();

  late List<String> commands;

  factory DataGit.fromJson(Map<String, dynamic> json) =>
      _$DataGitFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitToJson(this);
}

//GitCommit
@JsonSerializable()
class DataGitCommit extends DataParam {
  DataGitCommit();

  late bool? addNewFile;
  late String message;

  factory DataGitCommit.fromJson(Map<String, dynamic> json) =>
      _$DataGitCommitFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitCommitToJson(this);
}

//GitBranch
@JsonSerializable()
class DataGitBranch extends DataParam {
  DataGitBranch();

  late String? path;
  late int? startDay;
  late String? setBranches;

  factory DataGitBranch.fromJson(Map<String, dynamic> json) =>
      _$DataGitBranchFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitBranchToJson(this);
}

@JsonSerializable()
class BranchInfo {
  BranchInfo();

  late String? ref;
  late String? sha;
  late String? date;

  factory BranchInfo.fromJson(Map<String, dynamic> json) =>
      _$BranchInfoFromJson(json);
  Map<String, dynamic> toJson() => _$BranchInfoToJson(this);
}

//GitPull
@JsonSerializable()
class DataGitPull extends DataParam {
  DataGitPull();

  late String branch;

  factory DataGitPull.fromJson(Map<String, dynamic> json) =>
      _$DataGitPullFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitPullToJson(this);
}

//GitPush
@JsonSerializable()
class DataGitPush extends DataParam {
  DataGitPush();

  late String? branch;

  factory DataGitPush.fromJson(Map<String, dynamic> json) =>
      _$DataGitPushFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitPushToJson(this);
}

//GitCheckout
@JsonSerializable()
class DataGitCheckout extends DataParam {
  DataGitCheckout();

  late String branch;
  late bool? executePull;

  factory DataGitCheckout.fromJson(Map<String, dynamic> json) =>
      _$DataGitCheckoutFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitCheckoutToJson(this);
}

//GitCount
@JsonSerializable()
class DataGitCount extends DataParam {
  DataGitCount();

  late String setValue;

  factory DataGitCount.fromJson(Map<String, dynamic> json) =>
      _$DataGitCountFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitCountToJson(this);
}

//GitRev
@JsonSerializable()
class DataGitRev extends DataParam {
  DataGitRev();

  //null will be show local HEAD. Get last revision must be set branch
  late String? branch;
  late String setValue;

  factory DataGitRev.fromJson(Map<String, dynamic> json) =>
      _$DataGitRevFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitRevToJson(this);
}

//GitReset
@JsonSerializable()
class DataGitReset extends DataParam {
  DataGitReset();

  late bool? force = true;

  factory DataGitReset.fromJson(Map<String, dynamic> json) =>
      _$DataGitResetFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitResetToJson(this);
}

//GitStashPush
@JsonSerializable()
class DataGitStashPush extends DataParam {
  DataGitStashPush();

  late bool? includeUntracked = true;
  late String? message;
  late String? setSuccess;

  factory DataGitStashPush.fromJson(Map<String, dynamic> json) =>
      _$DataGitStashPushFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitStashPushToJson(this);
}

//GitStashApply
@JsonSerializable()
class DataGitStashApply extends DataParam {
  DataGitStashApply();

  late String? message;
  late bool? delete = true;

  factory DataGitStashApply.fromJson(Map<String, dynamic> json) =>
      _$DataGitStashApplyFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitStashApplyToJson(this);
}

//GitHub
@JsonSerializable()
class DataGitHub extends DataParam {
  DataGitHub();

  late List<String> commands;

  factory DataGitHub.fromJson(Map<String, dynamic> json) =>
      _$DataGitHubFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitHubToJson(this);
}

//GitHub Pull Request Create
//https://cli.github.com/manual/gh_codespace_create
@JsonSerializable()
class DataGitHubPullRequestCreate extends DataParam {
  DataGitHubPullRequestCreate();

  late String title;
  late String body;
  late String branch;
  late String setURL;
  late String setNumber;

  factory DataGitHubPullRequestCreate.fromJson(Map<String, dynamic> json) =>
      _$DataGitHubPullRequestCreateFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitHubPullRequestCreateToJson(this);
}

//GitHub Pull Request List
//https://cli.github.com/manual/gh_pr_list
@JsonSerializable()
class DataGitHubPullRequestList extends DataParam {
  DataGitHubPullRequestList();

  late List<String> keys;
  late String targetKey;
  late String targetValue;
  late String setValue;

  factory DataGitHubPullRequestList.fromJson(Map<String, dynamic> json) =>
      _$DataGitHubPullRequestListFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitHubPullRequestListToJson(this);
}

//GitHub Pull Request Close
//https://cli.github.com/manual/gh_pr_close
@JsonSerializable()
class DataGitHubPullRequestClose extends DataParam {
  DataGitHubPullRequestClose();

  late String number;

  factory DataGitHubPullRequestClose.fromJson(Map<String, dynamic> json) =>
      _$DataGitHubPullRequestCloseFromJson(json);
  @override
  Map<String, dynamic> toJson() => _$DataGitHubPullRequestCloseToJson(this);
}
