1use std::collections::HashSet;
2
3use indexmap::IndexSet;
4use serde::{Deserialize, Serialize};
5
6pub type CommandArgs = IndexSet<String>;
7
8#[derive(Deserialize, Debug)]
9#[serde(rename_all = "kebab-case")]
10pub struct Configuration {
11 pub local_branch: String,
12 pub patches: Option<HashSet<String>>,
13 pub pull_requests: Vec<String>,
14 pub remote_branch: String,
15 pub repo: String,
16}
17
18#[derive(Serialize, Deserialize, Debug)]
19pub struct GitHubResponse {
20 pub head: Head,
21 pub title: String,
22 pub html_url: String,
23}
24
25#[derive(Serialize, Deserialize, Debug)]
26pub struct Head {
27 pub repo: Repo,
28 pub r#ref: String,
29}
30
31#[derive(Serialize, Deserialize, Debug)]
32pub struct Repo {
33 pub clone_url: String,
34}
35
36#[derive(Debug)]
37pub struct Branch {
38 pub upstream_branch_name: String,
39 pub local_branch_name: String,
40}
41
42#[derive(Debug)]
43pub struct Remote {
44 pub repository_url: String,
45 pub local_remote_alias: String,
46}
47
48#[derive(Debug)]
49pub struct BranchAndRemote {
50 pub branch: Branch,
51 pub remote: Remote,
52}
53
54impl BranchAndRemote {
55 pub fn new(
56 local_branch: &str,
57 remote_branch: &str,
58 local_remote: &str,
59 remote_remote: &str,
60 ) -> Self {
61 let branch = Branch {
62 local_branch_name: local_branch.into(),
63 upstream_branch_name: remote_branch.into(),
64 };
65 let remote = Remote {
66 local_remote_alias: local_remote.into(),
67 repository_url: remote_remote.into(),
68 };
69 Self { branch, remote }
70 }
71}