34 lines
722 B
TypeScript
34 lines
722 B
TypeScript
import type { FromSchema } from "json-schema-to-ts";
|
|
import * as j from "json-schema-shorthand";
|
|
|
|
import { reqsSchema } from "../reqs";
|
|
|
|
export const identificationSchema = j.object(
|
|
{
|
|
shipType: "string",
|
|
shipClass: "string",
|
|
isCarrier: { type: "boolean", default: false },
|
|
reqs: {
|
|
allOf: ["#/$defs/reqs", { object: { usedMass: "number" } }],
|
|
},
|
|
} as const,
|
|
{
|
|
additionalProperties: false,
|
|
$defs: {
|
|
reqs: reqsSchema,
|
|
},
|
|
default: {
|
|
shipType: "",
|
|
shipClass: "",
|
|
isCarrier: false,
|
|
reqs: {
|
|
mass: 10,
|
|
cost: 0,
|
|
usedMass: 0,
|
|
},
|
|
},
|
|
} as const
|
|
);
|
|
|
|
export type Identification = FromSchema<typeof identificationSchema>;
|