aboutsummaryrefslogtreecommitdiffstats
path: root/packages/shared/src/stores/ServiceSettingsBase.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/shared/src/stores/ServiceSettingsBase.ts')
-rw-r--r--packages/shared/src/stores/ServiceSettingsBase.ts57
1 files changed, 57 insertions, 0 deletions
diff --git a/packages/shared/src/stores/ServiceSettingsBase.ts b/packages/shared/src/stores/ServiceSettingsBase.ts
new file mode 100644
index 0000000..b9df516
--- /dev/null
+++ b/packages/shared/src/stores/ServiceSettingsBase.ts
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2022 Kristóf Marussy <kristof@marussy.com>
3 *
4 * This file is part of Sophie.
5 *
6 * Sophie is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 *
18 * SPDX-License-Identifier: AGPL-3.0-only
19 */
20
21import {
22 Instance,
23 types,
24 SnapshotIn,
25 SnapshotOut,
26 IAnyModelType,
27} from 'mobx-state-tree';
28
29import ProfileBase from './Profile.js';
30
31export function defineServiceSettingsModel<TP extends IAnyModelType>(
32 profile: TP,
33) {
34 return types.model('ServiceSettings', {
35 name: types.string,
36 profile: types.reference(profile),
37 // TODO: Remove this once recipes are added.
38 url: types.string,
39 });
40}
41
42const ServiceSettingsBase = /* @__PURE__ */ (() =>
43 defineServiceSettingsModel(ProfileBase))();
44
45/*
46 eslint-disable-next-line @typescript-eslint/no-redeclare --
47 Intentionally naming the type the same as the store definition.
48*/
49interface ServiceSettingsBase extends Instance<typeof ServiceSettingsBase> {}
50
51export default ServiceSettingsBase;
52
53export interface ServiceSettingsSnapshotIn
54 extends SnapshotIn<typeof ServiceSettingsBase> {}
55
56export interface ServiceSettingsSnapshotOut
57 extends SnapshotOut<typeof ServiceSettingsBase> {}