"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.featureSchema = exports.featureResultsSchema = exports.featureResultsOverviewSchema = void 0;
const CommonSchemas = __importStar(require("./mongoose-common-schemas"));
// import * as ScenarioSchemas from './mongoose-scenario-schemas';
const mongoose_1 = require("mongoose");
exports.featureResultsOverviewSchema = new mongoose_1.Schema({
    duration: { required: false, type: Number },
    durationHHMMSS: { required: false, type: String },
    status: [{ required: false, type: String }],
    statusIcons: [{ required: false, type: String }],
}, {
    _id: false,
    id: false,
});
exports.featureResultsSchema = new mongoose_1.Schema({
    overview: exports.featureResultsOverviewSchema,
    scenarios: CommonSchemas.moduleResultsSchema,
    steps: CommonSchemas.moduleResultsSchema,
}, {
    _id: false,
    id: false,
});
exports.featureSchema = new mongoose_1.Schema({
    // Index: { required: false, type: Number },
    ObjectId: { required: false, type: String },
    description: { required: false, type: String },
    // elements: [{ required: false, type:ScenarioSchemas.scenarioSchema }],
    // elements: [{ ref: 'Scenario', required: false, type: ScenarioSchemas.scenarioSchema }],
    id: { required: true, type: String },
    keyword: { required: true, type: String },
    line: { required: true, type: Number },
    metadata: [{ required: false, type: CommonSchemas.metadataSchema }],
    name: { required: true, type: String },
    reportId: { ref: 'Report', type: mongoose_1.Schema.Types.ObjectId },
    results: exports.featureResultsSchema,
    tags: [CommonSchemas.tagSchema],
    uri: { required: true, type: String },
}, {
    // _id: false,
    // id: false,
    toJSON: {
        transform: (ret) => {
            delete ret._id;
        },
        versionKey: false,
        virtuals: true
    },
    toObject: {
        versionKey: false,
        virtuals: true
    }
});
exports.featureSchema.virtual('elements', {
    foreignField: 'featureId',
    justOne: false,
    localField: '_id',
    ref: 'Scenario',
});
//# sourceMappingURL=mongoose-feature-schemas.js.map