import z from "zod";

export const GenderSchema = z.enum(["male", "female", "other"]);

export const RelationshipStatusSchema = z.enum([
  "single",
  "relationship",
  "married",
  "complicated",
  "other",
]);

export const CreateAuthorizeUserSchema = z.object({
  name: z.string(),
  birthdate: z.string().optional(),
  gender: GenderSchema,
  birthplace: z.object({
    address: z.string().optional(),
    coords: z.string().optional(),
  }),
  relationship_status: RelationshipStatusSchema,
});

export const CreateAuthorizeRequestSchema = z.object({
  email: z.string(),
  locale: z.string(),
  timezone: z.string(),
  source: z.string(),
  profile: CreateAuthorizeUserSchema.optional(),
  partner: CreateAuthorizeUserSchema.omit({
    relationship_status: true,
  }).optional(),
  sign: z.boolean(),
  signDate: z.string().optional(),
  feature: z.string().optional(),
});

export const CreateAuthorizeResponseSchema = z.object({
  token: z.string(),
  userId: z.string().optional(),
  generatingVideo: z.boolean().optional(),
  videoId: z.string().nullable().optional(),
  authCode: z.string().optional(),
});

export type ICreateAuthorizeUser = z.infer<typeof CreateAuthorizeUserSchema>;

export type ICreateAuthorizeRequest = z.infer<
  typeof CreateAuthorizeRequestSchema
>;

export type ICreateAuthorizeResponse = z.infer<
  typeof CreateAuthorizeResponseSchema
>;
