"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AssetEditsResponseDto = exports.AssetEditsCreateDto = exports.AssetEditActionItemResponseDto = exports.AssetEditActionItemDto = exports.MirrorParameters = exports.RotateParameters = exports.CropParameters = exports.MirrorAxis = exports.AssetEditAction = void 0;
const openapi = require("@nestjs/swagger");
const swagger_1 = require("@nestjs/swagger");
const class_transformer_1 = require("class-transformer");
const class_validator_1 = require("class-validator");
const validation_1 = require("../validation");
var AssetEditAction;
(function (AssetEditAction) {
    AssetEditAction["Crop"] = "crop";
    AssetEditAction["Rotate"] = "rotate";
    AssetEditAction["Mirror"] = "mirror";
})(AssetEditAction || (exports.AssetEditAction = AssetEditAction = {}));
var MirrorAxis;
(function (MirrorAxis) {
    MirrorAxis["Horizontal"] = "horizontal";
    MirrorAxis["Vertical"] = "vertical";
})(MirrorAxis || (exports.MirrorAxis = MirrorAxis = {}));
class CropParameters {
    x;
    y;
    width;
    height;
    static _OPENAPI_METADATA_FACTORY() {
        return { x: { required: true, type: () => Number, minimum: 0 }, y: { required: true, type: () => Number, minimum: 0 }, width: { required: true, type: () => Number, minimum: 1 }, height: { required: true, type: () => Number, minimum: 1 } };
    }
}
exports.CropParameters = CropParameters;
__decorate([
    (0, class_validator_1.IsInt)(),
    (0, class_validator_1.Min)(0),
    (0, swagger_1.ApiProperty)({ description: 'Top-Left X coordinate of crop' }),
    __metadata("design:type", Number)
], CropParameters.prototype, "x", void 0);
__decorate([
    (0, class_validator_1.IsInt)(),
    (0, class_validator_1.Min)(0),
    (0, swagger_1.ApiProperty)({ description: 'Top-Left Y coordinate of crop' }),
    __metadata("design:type", Number)
], CropParameters.prototype, "y", void 0);
__decorate([
    (0, class_validator_1.IsInt)(),
    (0, class_validator_1.Min)(1),
    (0, swagger_1.ApiProperty)({ description: 'Width of the crop' }),
    __metadata("design:type", Number)
], CropParameters.prototype, "width", void 0);
__decorate([
    (0, class_validator_1.IsInt)(),
    (0, class_validator_1.Min)(1),
    (0, swagger_1.ApiProperty)({ description: 'Height of the crop' }),
    __metadata("design:type", Number)
], CropParameters.prototype, "height", void 0);
class RotateParameters {
    angle;
    static _OPENAPI_METADATA_FACTORY() {
        return { angle: { required: true, type: () => Number } };
    }
}
exports.RotateParameters = RotateParameters;
__decorate([
    (0, validation_1.IsAxisAlignedRotation)(),
    (0, swagger_1.ApiProperty)({ description: 'Rotation angle in degrees' }),
    __metadata("design:type", Number)
], RotateParameters.prototype, "angle", void 0);
class MirrorParameters {
    axis;
    static _OPENAPI_METADATA_FACTORY() {
        return { axis: { required: true, enum: require("./editing.dto").MirrorAxis } };
    }
}
exports.MirrorParameters = MirrorParameters;
__decorate([
    (0, class_validator_1.IsEnum)(MirrorAxis),
    (0, swagger_1.ApiProperty)({ enum: MirrorAxis, enumName: 'MirrorAxis', description: 'Axis to mirror along' }),
    __metadata("design:type", String)
], MirrorParameters.prototype, "axis", void 0);
let AssetEditActionItemDto = class AssetEditActionItemDto {
    action;
    parameters;
    static _OPENAPI_METADATA_FACTORY() {
        return { action: { required: true, enum: require("./editing.dto").AssetEditAction }, parameters: { required: true, type: () => Object } };
    }
};
exports.AssetEditActionItemDto = AssetEditActionItemDto;
__decorate([
    (0, validation_1.ValidateEnum)({ name: 'AssetEditAction', enum: AssetEditAction, description: 'Type of edit action to perform' }),
    __metadata("design:type", String)
], AssetEditActionItemDto.prototype, "action", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'List of edit actions to apply (crop, rotate, or mirror)',
        anyOf: [CropParameters, RotateParameters, MirrorParameters].map((type) => ({
            $ref: (0, swagger_1.getSchemaPath)(type),
        })),
    }),
    (0, class_validator_1.ValidateNested)(),
    (0, class_transformer_1.Type)((options) => actionParameterMap[options?.object.action]),
    __metadata("design:type", Object)
], AssetEditActionItemDto.prototype, "parameters", void 0);
exports.AssetEditActionItemDto = AssetEditActionItemDto = __decorate([
    (0, swagger_1.ApiExtraModels)(CropParameters, RotateParameters, MirrorParameters)
], AssetEditActionItemDto);
class AssetEditActionItemResponseDto extends AssetEditActionItemDto {
    id;
    static _OPENAPI_METADATA_FACTORY() {
        return { id: { required: true, type: () => String } };
    }
}
exports.AssetEditActionItemResponseDto = AssetEditActionItemResponseDto;
__decorate([
    (0, validation_1.ValidateUUID)(),
    __metadata("design:type", String)
], AssetEditActionItemResponseDto.prototype, "id", void 0);
const actionParameterMap = {
    [AssetEditAction.Crop]: CropParameters,
    [AssetEditAction.Rotate]: RotateParameters,
    [AssetEditAction.Mirror]: MirrorParameters,
};
class AssetEditsCreateDto {
    edits;
    static _OPENAPI_METADATA_FACTORY() {
        return { edits: { required: true, type: () => [require("./editing.dto").AssetEditActionItemDto], minItems: 1 } };
    }
}
exports.AssetEditsCreateDto = AssetEditsCreateDto;
__decorate([
    (0, class_validator_1.ArrayMinSize)(1),
    (0, validation_1.IsUniqueEditActions)(),
    (0, class_validator_1.ValidateNested)({ each: true }),
    (0, class_transformer_1.Type)(() => AssetEditActionItemDto),
    (0, swagger_1.ApiProperty)({ description: 'List of edit actions to apply (crop, rotate, or mirror)' }),
    __metadata("design:type", Array)
], AssetEditsCreateDto.prototype, "edits", void 0);
class AssetEditsResponseDto {
    assetId;
    edits;
    static _OPENAPI_METADATA_FACTORY() {
        return { assetId: { required: true, type: () => String }, edits: { required: true, type: () => [require("./editing.dto").AssetEditActionItemResponseDto] } };
    }
}
exports.AssetEditsResponseDto = AssetEditsResponseDto;
__decorate([
    (0, validation_1.ValidateUUID)({ description: 'Asset ID these edits belong to' }),
    __metadata("design:type", String)
], AssetEditsResponseDto.prototype, "assetId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'List of edit actions applied to the asset',
    }),
    __metadata("design:type", Array)
], AssetEditsResponseDto.prototype, "edits", void 0);
//# sourceMappingURL=editing.dto.js.map