import { z } from 'zod';

import { ApplicationRole } from '@kit/accounts/types/accounts';

const ConfirmationSchema = z.object({
  confirmation: z.custom<string>((value) => value === 'CONFIRM'),
});

const UserIdSchema = ConfirmationSchema.extend({
  userId: z.string().uuid(),
});

export const BanUserSchema = UserIdSchema;
export const ReactivateUserSchema = UserIdSchema;
export const ImpersonateUserSchema = UserIdSchema;
export const DeleteUserSchema = UserIdSchema;

export const DeleteAccountSchema = ConfirmationSchema.extend({
  accountId: z.string().uuid(),
});

export const UpdateAccountRoleSchema = z.object({
  accountId: z.string().uuid(),
  role: z.string() as z.ZodType<ApplicationRole>,
});
