2021-07-16 09:52:51 +02:00
|
|
|
import * as tg from "generic-type-guard";
|
|
|
|
import { isCharacterTexture } from "./CharacterTexture";
|
2021-12-14 18:55:41 +01:00
|
|
|
import { isNumber } from "generic-type-guard";
|
2021-07-16 09:52:51 +02:00
|
|
|
|
|
|
|
/*const isNumericEnum =
|
|
|
|
<T extends { [n: number]: string }>(vs: T) =>
|
|
|
|
(v: any): v is T =>
|
|
|
|
typeof v === "number" && v in vs;*/
|
|
|
|
|
|
|
|
export const isMapDetailsData = new tg.IsInterface()
|
|
|
|
.withProperties({
|
|
|
|
roomSlug: tg.isOptional(tg.isString), // deprecated
|
|
|
|
mapUrl: tg.isString,
|
|
|
|
policy_type: isNumber, //isNumericEnum(GameRoomPolicyTypes),
|
|
|
|
tags: tg.isArray(tg.isString),
|
|
|
|
textures: tg.isArray(isCharacterTexture),
|
2021-09-21 20:24:53 +02:00
|
|
|
contactPage: tg.isUnion(tg.isString, tg.isUndefined),
|
2021-11-12 16:43:37 +01:00
|
|
|
authenticationMandatory: tg.isUnion(tg.isBoolean, tg.isUndefined),
|
2021-12-14 19:03:02 +01:00
|
|
|
group: tg.isNullable(tg.isString),
|
|
|
|
})
|
|
|
|
.withOptionalProperties({
|
|
|
|
iframeAuthentication: tg.isNullable(tg.isString),
|
2021-07-16 09:52:51 +02:00
|
|
|
})
|
|
|
|
.get();
|
2021-09-21 20:24:53 +02:00
|
|
|
|
2021-07-16 09:52:51 +02:00
|
|
|
export type MapDetailsData = tg.GuardedType<typeof isMapDetailsData>;
|