import { z } from 'zod';
import { DEFAULT_UUID, RegionCode } from './constants.js';
import { ZModule } from './modules.js';
export var ProfileLinkTypes;
(function (ProfileLinkTypes) {
    // Socials
    ProfileLinkTypes["DISCORD"] = "DISCORD";
    ProfileLinkTypes["FACEBOOK"] = "FACEBOOK";
    ProfileLinkTypes["INSTAGRAM"] = "INSTAGRAM";
    ProfileLinkTypes["LINKEDIN"] = "LINKEDIN";
    ProfileLinkTypes["MEDIUM"] = "MEDIUM";
    ProfileLinkTypes["MESSENGER"] = "MESSENGER";
    ProfileLinkTypes["PINTEREST"] = "PINTEREST";
    ProfileLinkTypes["REDDIT"] = "REDDIT";
    ProfileLinkTypes["TELEGRAM"] = "TELEGRAM";
    ProfileLinkTypes["THREADS"] = "THREADS";
    ProfileLinkTypes["TWITTER"] = "TWITTER";
    ProfileLinkTypes["TIKTOK"] = "TIKTOK";
    ProfileLinkTypes["SNAPCHAT"] = "SNAPCHAT";
    ProfileLinkTypes["WHATSAPP"] = "WHATSAPP";
    // Streaming
    ProfileLinkTypes["AMAZON_MUSIC"] = "AMAZON_MUSIC";
    ProfileLinkTypes["APPLE_MUSIC"] = "APPLE_MUSIC";
    ProfileLinkTypes["BEATPORT"] = "BEATPORT";
    ProfileLinkTypes["DEEZER"] = "DEEZER";
    ProfileLinkTypes["SOUNDCLOUD"] = "SOUNDCLOUD";
    ProfileLinkTypes["SPOTIFY"] = "SPOTIFY";
    ProfileLinkTypes["TIDAL"] = "TIDAL";
    ProfileLinkTypes["TWITCH"] = "TWITCH";
    ProfileLinkTypes["YOUTUBE"] = "YOUTUBE";
    ProfileLinkTypes["YOUTUBE_MUSIC"] = "YOUTUBE_MUSIC";
    // Other
    ProfileLinkTypes["AMAZON"] = "AMAZON";
    ProfileLinkTypes["BANDSINTOWN"] = "BANDSINTOWN";
    ProfileLinkTypes["EMAIL"] = "EMAIL";
    ProfileLinkTypes["IMDB"] = "IMDB";
    ProfileLinkTypes["SUBSTACK"] = "SUBSTACK";
    ProfileLinkTypes["WEBSITE"] = "WEBSITE";
})(ProfileLinkTypes || (ProfileLinkTypes = {}));
export var ProfileTier;
(function (ProfileTier) {
    ProfileTier[ProfileTier["TOP"] = -1] = "TOP";
    ProfileTier[ProfileTier["TRIAL"] = 0] = "TRIAL";
    ProfileTier[ProfileTier["STARTER"] = 1] = "STARTER";
    ProfileTier[ProfileTier["PRO"] = 2] = "PRO";
    ProfileTier[ProfileTier["MAX"] = 3] = "MAX";
})(ProfileTier || (ProfileTier = {}));
export const ZProfileLink = z.object({
    link: z.string(),
    localizationId: z.string().uuid().nullable().default(DEFAULT_UUID).optional(),
    order: z.number().optional(),
    profileId: z.string().uuid().optional(),
    type: z.nativeEnum(ProfileLinkTypes),
    versionId: z.string().uuid().optional()
});
export const ZProfileLinksBody = z.object({
    links: z.array(ZProfileLink.omit({ localizationId: true, profileId: true }))
});
export const withProfileLinksBody = createZodValidator(ZProfileLinksBody);
function createZodValidator(zType) {
    return (value) => {
        const result = zType.safeParse(value);
        if (result.success === true)
            return {
                success: true,
                value: result.data
            };
        const error = result.error;
        return {
            issues: error.errors,
            success: false
        };
    };
}
export var ThemeTypes;
(function (ThemeTypes) {
    ThemeTypes["DARK"] = "DARK";
    ThemeTypes["LIGHT"] = "LIGHT";
    ThemeTypes["CUSTOM"] = "CUSTOM";
})(ThemeTypes || (ThemeTypes = {}));
export const ZTheme = z.object({
    backgroundColor: z.string(),
    localizationId: z.string().uuid(),
    overlayColor: z.string(),
    overlayOpacity: z.number(),
    profileId: z.string().uuid(),
    typographyColor: z.string(),
    versionId: z.string().uuid().optional()
});
export const ZCreateThemeBody = z.object({
    theme: ZTheme.omit({ localizationId: true, profileId: true }),
    type: z.string()
});
export const ZRegion = z.object({
    code: z.nativeEnum(RegionCode),
    region: z.string().optional().nullable()
    //currency: z.string() - Deprecated
});
export const ZProfileInfo = z.object({
    categoryId: z.number(),
    categoryName: z.string(),
    createdVia: z.string(),
    currency: z.string().default('gbp'),
    isActive: z.boolean(),
    isLocalizationEnabled: z.boolean(),
    name: z.string(),
    profileId: z.string().uuid(),
    status: z.string()
});
export const ZMetaPixel = z.object({
    conversionApiAccessToken: z.string(),
    localizationId: z.string().uuid().default(DEFAULT_UUID).optional(),
    pixelId: z.string(),
    profileId: z.string().uuid()
});
export const ZLocalization = z.object({
    avatar: z.string().nullable(),
    avatarFilename: z.string().nullable(),
    avatarRatio: z.number().nullable(),
    displayName: z.string().nullable(),
    displayNameImage: z.string().nullable(),
    displayNameImageScale: z.string().nullable(),
    displayNameType: z.string(),
    id: z.string().uuid(),
    isActive: z.boolean(),
    isPublished: z.boolean().optional().nullable(),
    metaPixel: ZMetaPixel.optional(),
    name: z.string(),
    privacyPolicyName: z.string().optional().nullable(),
    privacyPolicyUrl: z.string().optional().nullable(),
    profileId: z.string().uuid(),
    showDisplayName: z.boolean(),
    themeType: z.string(),
    versionId: z.string().uuid().optional()
});
export const ZLocalizationBody = ZLocalization.partial();
export const ZFullProfileData = z.object({
    handle: z.string(),
    modules: z.array(ZModule),
    profileInfo: ZProfileInfo.partial().extend({
        localization: z.array(ZLocalization)
    }),
    tier: z.nativeEnum(ProfileTier).optional()
});
