"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContentFileService = exports.ContentFileRepository = exports.ContentFile = exports.File = void 0;
const tslib_1 = require("tslib");
const core_1 = require("@loopback/core");
const repository_1 = require("@loopback/repository");
const constants_1 = require("../../constants");
const db_datasource_1 = require("../../datasources/db.datasource");
const content_extension_definition_1 = require("../../integration/content-extension.definition");
const content_entity_service_1 = require("../../services/content-entity/content-entity.service");
const content_file_const_1 = require("./content-file.const");
let File = class File extends repository_1.Entity {
};
tslib_1.__decorate([
    repository_1.property({
        type: 'string',
    }),
    tslib_1.__metadata("design:type", String)
], File.prototype, "base64", void 0);
tslib_1.__decorate([
    repository_1.property({
        type: 'string',
    }),
    tslib_1.__metadata("design:type", String)
], File.prototype, "size", void 0);
tslib_1.__decorate([
    repository_1.property({
        type: 'string',
    }),
    tslib_1.__metadata("design:type", String)
], File.prototype, "name", void 0);
tslib_1.__decorate([
    repository_1.property({
        type: 'string',
    }),
    tslib_1.__metadata("design:type", String)
], File.prototype, "type", void 0);
File = tslib_1.__decorate([
    repository_1.model()
], File);
exports.File = File;
let ContentFile = class ContentFile extends content_extension_definition_1.ContentExtension {
};
ContentFile = tslib_1.__decorate([
    repository_1.model({ settings: { strict: false } })
], ContentFile);
exports.ContentFile = ContentFile;
let ContentFileRepository = class ContentFileRepository extends content_extension_definition_1.ContentExtensionRepository {
    constructor(dataSource, objectNodeRepositoryGetter) {
        super(ContentFile, dataSource, objectNodeRepositoryGetter);
        this.objectNodeRepositoryGetter = objectNodeRepositoryGetter;
    }
};
ContentFileRepository = tslib_1.__decorate([
    tslib_1.__param(0, core_1.inject(constants_1.DATASTORE_DB)),
    tslib_1.__param(1, repository_1.repository.getter('ObjectNodeRepository')),
    tslib_1.__metadata("design:paramtypes", [db_datasource_1.DbDataSource, Function])
], ContentFileRepository);
exports.ContentFileRepository = ContentFileRepository;
let ContentFileService = class ContentFileService extends content_extension_definition_1.ContentExtensionService {
    constructor(contentEntityService, contentExtensionRepository) {
        super(content_file_const_1.CONTENT_FILE_PROVIDER, ContentFileService.name, contentEntityService, contentExtensionRepository, 'ContentFile');
        this.contentEntityService = contentEntityService;
        this.contentExtensionRepository = contentExtensionRepository;
    }
    async getContentDefinition() {
        return {
            properties: {
                contentFile: {
                    type: 'object',
                    title: 'File',
                    'x-schema-form': {
                        type: 'file',
                    },
                    properties: {
                        base64: { type: 'string', required: false },
                        size: { type: 'string', required: false },
                        name: { type: 'string', required: false },
                        type: { type: 'string', required: false },
                        id: { type: 'string', required: false },
                        uri: { type: 'string', required: false },
                    },
                },
            },
        };
    }
};
ContentFileService = tslib_1.__decorate([
    tslib_1.__param(0, core_1.service(content_entity_service_1.ContentEntityService)),
    tslib_1.__param(1, repository_1.repository(ContentFileRepository)),
    tslib_1.__metadata("design:paramtypes", [content_entity_service_1.ContentEntityService,
        ContentFileRepository])
], ContentFileService);
exports.ContentFileService = ContentFileService;
//# sourceMappingURL=content-file.definition.js.map