import { z } from 'zod';
import { UserRoleType } from '@komi-app/roles';
import { ZThirdParties } from '../third-party.js';
export const ZUser = z.object({
    avatar: z.string().url().optional(),
    country: z.string().optional(),
    createdAt: z.string().datetime(),
    dateOfBirth: z.string().datetime().optional(),
    email: z.string(),
    firstName: z.string().optional(),
    gender: z.string().optional(),
    isEmailVerified: z.boolean(),
    lastName: z.string().optional(),
    legacyId: z.number().int(),
    localCurrency: z.string().optional(),
    passwordHash: z.string().optional(),
    phone: z.string().optional(),
    thirdPartyInfo: z.string().optional(),
    thirdPartyName: ZThirdParties.optional(),
    thirdPartyUserId: z.string().optional(),
    timezone: z.string().optional(),
    updatedAt: z.string().datetime().optional(),
    userId: z.string().uuid()
});
export const ZUpdateUser = ZUser.partial();
export const ZCreateUserBase = ZUser.pick({
    avatar: true,
    email: true,
    firstName: true,
    lastName: true
}).extend({
    productId: z.string().optional(),
    ucc: z.string().optional()
});
export const ZCreateGoogleUser = ZCreateUserBase.extend({
    thirdPartyUserId: z.string()
});
export const ZCreatePasswordUser = ZCreateUserBase.extend({
    passwordHash: z.string()
});
export const ZReturnedUser = ZUser.pick({
    createdAt: true,
    isEmailVerified: true,
    legacyId: true,
    userId: true
});
export const ZLegacyVerifyEmailUser = ZUser.pick({
    email: true
});
export const ZLegacyUpdatePassword = z.object({
    id: z.number(),
    passwordHash: z.string()
});
export const ZLegacyUser = z.object({
    authProviderId: z.string().nullish(),
    avatar: z.string().url().nullish(),
    country: z.string().nullish(),
    createdAt: z.string().datetime().nullish(),
    dateOfBirth: z.string().datetime().nullish(),
    email: z.string().nullish(),
    emailVerified: z.boolean().nullish(),
    firstName: z.string().nullish(),
    gender: z.string().nullish(),
    hasNoId: z.boolean().nullish(),
    id: z.number().nullish(),
    lastName: z.string().nullish(),
    localCurrency: z.string().nullish(),
    passwordHash: z.string().nullish(),
    phone: z.string().nullish(),
    profileCollabs: z.array(z.string()).nullish(),
    roles: z
        .array(z
        .object({
        createdAt: z.string().datetime().nullish(),
        id: z.number().nullish(),
        name: z
            .enum([
            'user',
            'talent',
            'admin',
            'moderator',
            'external',
            'selfsign'
        ])
            .nullish(),
        updatedAt: z.string().datetime().nullish()
    })
        .nullish())
        .nullish(),
    thirdPartyInfo: z.any().nullish(),
    timezone: z.string().nullish(),
    updatedAt: z.string().datetime().nullish()
});
export const ZDeleteLegacyRoleUser = z.object({
    id: z.number().int(),
    role: z.nativeEnum(UserRoleType)
});
export const ZEditLegacyProfileRoleUser = z.object({
    id: z.number().int(),
    profileId: z.string().uuid()
});
