/**
 * 游客登录响应
 *
 */
import { z } from "zod";

import { booleanOrTrue, numberOr, schemaOr } from "../../nullable-defaults";
import { EMPTY_USER, UserSchema } from "../../user/user";

export const GuestLoginResponseSchema = z
  .object({
    token: z.string(),
    deviceId: z.string(),
    userId: z.string(),
    isDeviceUser: booleanOrTrue,
    expiresIn: numberOr(2592000),
    user: schemaOr(UserSchema, EMPTY_USER),
  })
  .readonly();

export type GuestLoginResponseInput = z.input<typeof GuestLoginResponseSchema>;
export type GuestLoginResponseData = z.output<typeof GuestLoginResponseSchema>;

export type GuestLoginResponse = GuestLoginResponseData;
