1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5use crate::mojang::piston::PistonMetaArguments;
6
7#[derive(Debug, Clone, Deserialize, Serialize)]
8pub struct LoaderVersion {
9 pub separator: String,
10 pub build: i32,
11 pub maven: String,
12 pub version: String,
13 pub stable: bool,
14}
15
16#[derive(Debug, Clone, Deserialize, Serialize)]
17pub struct GameVersion {
18 pub version: String,
19 pub stable: bool,
20}
21
22#[derive(Debug, Clone, Deserialize, Serialize)]
23pub struct IntermediaryVersion {
24 pub maven: String,
25 pub version: String,
26 pub stable: bool,
27}
28
29#[derive(Debug, Clone, Deserialize, Serialize)]
30pub struct LoaderGameVersion {
31 pub loader: LoaderVersion,
32 pub intermediary: IntermediaryVersion,
33}
34
35#[derive(Debug, Clone, Deserialize, Serialize)]
36pub struct LauncherLibrary {
37 pub name: String,
38 pub url: String,
39}
40
41#[derive(Debug, Clone, Deserialize, Serialize)]
42pub struct LauncherLibraries {
43 pub client: Vec<LauncherLibrary>,
44 pub common: Vec<LauncherLibrary>,
45 pub server: Vec<LauncherLibrary>,
46}
47
48#[derive(Debug, Clone, Deserialize, Serialize)]
49pub struct LauncherMainClass {
50 pub client: String,
51 pub server: String,
52}
53
54#[derive(Debug, Clone, Deserialize, Serialize)]
55pub struct LauncherMeta {
56 pub version: usize,
57 pub libraries: LauncherLibraries,
58 #[serde(rename = "mainClass")]
59 pub main_class: LauncherMainClass,
60}
61
62#[derive(Debug, Clone, Deserialize, Serialize)]
63pub struct LoaderProfile {
64 pub loader: LoaderVersion,
65 pub intermediary: IntermediaryVersion,
66 #[serde(rename = "launcherMeta")]
67 pub launcher_meta: LauncherMeta,
68}
69
70#[derive(Debug, Clone, Deserialize, Serialize)]
71pub struct ProfileLibrary {
72 pub name: String,
73 pub url: String,
74 pub downloads: Option<ProfileLibraryDownloads>,
75 pub natives: Option<HashMap<String, String>>,
76 pub extract: Option<ProfileLibraryExtract>,
77}
78
79#[derive(Debug, Clone, Deserialize, Serialize)]
80pub struct ProfileLibraryDownloads {
81 pub artifact: Option<ProfileLibraryArtifact>,
82 pub classifiers: Option<HashMap<String, ProfileLibraryArtifact>>,
83}
84
85#[derive(Debug, Clone, Deserialize, Serialize)]
86pub struct ProfileLibraryArtifact {
87 pub path: String,
88 pub url: String,
89 pub size: Option<usize>,
90 pub sha1: Option<String>,
91}
92
93#[derive(Debug, Clone, Deserialize, Serialize)]
94pub struct ProfileLibraryExtract {
95 pub exclude: Vec<String>,
96}
97
98#[derive(Debug, Clone, Deserialize, Serialize)]
99pub struct ProfileLoggingFile {
100 pub id: String,
101 pub sha1: String,
102 pub size: usize,
103 pub url: String,
104}
105
106#[derive(Debug, Clone, Deserialize, Serialize)]
107pub struct ProfileLoggingClient {
108 pub argument: String,
109 pub file: ProfileLoggingFile,
110 #[serde(rename = "type")]
111 pub logging_type: String,
112}
113
114#[derive(Debug, Clone, Deserialize, Serialize)]
115pub struct ProfileLogging {
116 pub client: ProfileLoggingClient,
117}
118
119#[derive(Debug, Clone, Deserialize, Serialize)]
120pub struct ProfileJson {
121 pub id: String,
122 #[serde(rename = "inheritsFrom")]
123 pub inherits_from: String,
124 pub arguments: Option<PistonMetaArguments>,
125 pub assets: Option<String>,
126 pub libraries: Vec<ProfileLibrary>,
127 pub logging: Option<ProfileLogging>,
128 #[serde(rename = "mainClass")]
129 pub main_class: String,
130 #[serde(rename = "minimumLauncherVersion")]
131 pub minimum_launcher_version: Option<usize>,
132 #[serde(rename = "type")]
133 pub release_type: String,
134 pub time: String,
135 #[serde(rename = "releaseTime")]
136 pub release_time: String,
137}