/**
 * Interface of the server (auto-generated code)
 */
import { z as zod } from "zod";

import {ZodLong} from "./long";

export const ZodJwtPayload = zod.object({
	sub: zod.string(),
	application: zod.string(),
	iss: zod.string(),
	right: zod.record(zod.string(), zod.record(zod.string(), ZodLong)),
	login: zod.string(),
	exp: ZodLong,
	iat: ZodLong,

});

export type JwtPayload = zod.infer<typeof ZodJwtPayload>;

export function isJwtPayload(data: any): data is JwtPayload {
	try {
		ZodJwtPayload.parse(data);
		return true;
	} catch (e: any) {
		console.log(`Fail to parse data type='ZodJwtPayload' error=${e}`);
		return false;
	}
}
export const ZodJwtPayloadWrite = zod.object({
	sub: zod.string().optional(),
	application: zod.string().optional(),
	iss: zod.string().optional(),
	right: zod.record(zod.string(), zod.record(zod.string(), ZodLong)).optional(),
	login: zod.string().optional(),
	exp: ZodLong.optional(),
	iat: ZodLong.optional(),

});

export type JwtPayloadWrite = zod.infer<typeof ZodJwtPayloadWrite>;

export function isJwtPayloadWrite(data: any): data is JwtPayloadWrite {
	try {
		ZodJwtPayloadWrite.parse(data);
		return true;
	} catch (e: any) {
		console.log(`Fail to parse data type='ZodJwtPayloadWrite' error=${e}`);
		return false;
	}
}
