"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TagResponseDto = exports.TagBulkAssetsResponseDto = exports.TagBulkAssetsDto = exports.TagUpsertDto = exports.TagUpdateDto = exports.TagCreateDto = exports.TagResponseSchema = void 0;
exports.mapTag = mapTag;
const openapi = require("@nestjs/swagger");
const nestjs_zod_1 = require("nestjs-zod");
const date_1 = require("../utils/date");
const validation_1 = require("../validation");
const zod_1 = __importDefault(require("zod"));
const TagCreateSchema = zod_1.default
    .object({
    name: zod_1.default.string().describe('Tag name'),
    parentId: zod_1.default.uuidv4().nullish().describe('Parent tag ID'),
    color: validation_1.hexColor.nullable().optional().describe('Tag color (hex)'),
})
    .meta({ id: 'TagCreateDto' });
const TagUpdateSchema = zod_1.default
    .object({
    color: validation_1.hexColor.nullable().optional().describe('Tag color (hex)'),
})
    .meta({ id: 'TagUpdateDto' });
const TagUpsertSchema = zod_1.default
    .object({
    tags: zod_1.default.array(zod_1.default.string()).describe('Tag names to upsert'),
})
    .meta({ id: 'TagUpsertDto' });
const TagBulkAssetsSchema = zod_1.default
    .object({
    tagIds: zod_1.default.array(zod_1.default.uuidv4()).describe('Tag IDs'),
    assetIds: zod_1.default.array(zod_1.default.uuidv4()).describe('Asset IDs'),
})
    .meta({ id: 'TagBulkAssetsDto' });
const TagBulkAssetsResponseSchema = zod_1.default
    .object({
    count: zod_1.default.int().describe('Number of assets tagged'),
})
    .meta({ id: 'TagBulkAssetsResponseDto' });
exports.TagResponseSchema = zod_1.default
    .object({
    id: zod_1.default.uuidv4().describe('Tag ID'),
    parentId: zod_1.default.string().optional().describe('Parent tag ID'),
    name: zod_1.default.string().describe('Tag name'),
    value: zod_1.default.string().describe('Tag value (full path)'),
    createdAt: zod_1.default.string().meta({ format: 'date-time' }).describe('Creation date'),
    updatedAt: zod_1.default.string().meta({ format: 'date-time' }).describe('Last update date'),
    color: zod_1.default.string().optional().describe('Tag color (hex)'),
})
    .meta({ id: 'TagResponseDto' });
class TagCreateDto extends (0, nestjs_zod_1.createZodDto)(TagCreateSchema) {
    static _OPENAPI_METADATA_FACTORY() {
        return {};
    }
}
exports.TagCreateDto = TagCreateDto;
class TagUpdateDto extends (0, nestjs_zod_1.createZodDto)(TagUpdateSchema) {
    static _OPENAPI_METADATA_FACTORY() {
        return {};
    }
}
exports.TagUpdateDto = TagUpdateDto;
class TagUpsertDto extends (0, nestjs_zod_1.createZodDto)(TagUpsertSchema) {
    static _OPENAPI_METADATA_FACTORY() {
        return {};
    }
}
exports.TagUpsertDto = TagUpsertDto;
class TagBulkAssetsDto extends (0, nestjs_zod_1.createZodDto)(TagBulkAssetsSchema) {
    static _OPENAPI_METADATA_FACTORY() {
        return {};
    }
}
exports.TagBulkAssetsDto = TagBulkAssetsDto;
class TagBulkAssetsResponseDto extends (0, nestjs_zod_1.createZodDto)(TagBulkAssetsResponseSchema) {
    static _OPENAPI_METADATA_FACTORY() {
        return {};
    }
}
exports.TagBulkAssetsResponseDto = TagBulkAssetsResponseDto;
class TagResponseDto extends (0, nestjs_zod_1.createZodDto)(exports.TagResponseSchema) {
    static _OPENAPI_METADATA_FACTORY() {
        return {};
    }
}
exports.TagResponseDto = TagResponseDto;
function mapTag(entity) {
    return {
        id: entity.id,
        parentId: entity.parentId ?? undefined,
        name: entity.value.split('/').at(-1),
        value: entity.value,
        createdAt: (0, date_1.asDateTimeString)(entity.createdAt),
        updatedAt: (0, date_1.asDateTimeString)(entity.updatedAt),
        color: entity.color ?? undefined,
    };
}
//# sourceMappingURL=tag.dto.js.map