"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.walletDeviceParamsSchema = exports.walletNetworkParamsSchema = exports.walletAddressParamsSchema = exports.walletIdParamSchema = exports.seedPhraseSchema = exports.createWalletSchema = void 0;
const zod_1 = require("zod");
const SEED_PHRASE_WORD_COUNTS = [12, 18, 24];
const seedPhraseWordCount = (phrase) => {
    return phrase
        .trim()
        .split(/\s+/)
        .filter((word) => word.length > 0).length;
};
exports.createWalletSchema = zod_1.z.object({
    name: zod_1.z.string().min(1).max(100),
    syncType: zod_1.z.enum(['created', 'imported']),
    phrase: zod_1.z
        .string()
        .min(1)
        .refine((value) => {
        const wordCount = seedPhraseWordCount(value);
        return SEED_PHRASE_WORD_COUNTS.includes(wordCount);
    }, {
        message: `Secret phrase must contain ${SEED_PHRASE_WORD_COUNTS.join(', ')} words`,
    }),
    deviceIds: zod_1.z.array(zod_1.z.string().uuid()).min(1),
});
exports.seedPhraseSchema = zod_1.z.object({
    wordCount: zod_1.z.union([zod_1.z.literal(12), zod_1.z.literal(24)]).default(12),
});
exports.walletIdParamSchema = zod_1.z.object({
    id: zod_1.z.string().uuid(),
});
exports.walletAddressParamsSchema = zod_1.z.object({
    walletId: zod_1.z.string().uuid(),
});
exports.walletNetworkParamsSchema = zod_1.z.object({
    walletId: zod_1.z.string().uuid(),
    networkId: zod_1.z.string().uuid(),
});
exports.walletDeviceParamsSchema = zod_1.z.object({
    deviceId: zod_1.z.string().uuid(),
});
//# sourceMappingURL=wallet.dto.js.map