"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.scenarioSchema = exports.scenarioTag = exports.beforeOrAfterSchema = exports.scenarioResultsSchema = void 0;
const CommonSchemas = __importStar(require("./mongoose-common-schemas"));
const StepChemas = __importStar(require("./mongoose-step-schemas"));
const mongoose_1 = require("mongoose");
exports.scenarioResultsSchema = new mongoose_1.Schema({
    after: CommonSchemas.overviewResultsSchema,
    before: CommonSchemas.overviewResultsSchema,
    overview: CommonSchemas.overviewResultsSchema,
    steps: { required: false, type: CommonSchemas.overviewResultsSchema },
}, {
    _id: false,
    id: false,
});
exports.beforeOrAfterSchema = new mongoose_1.Schema({
    results: {
        overview: { required: false, type: CommonSchemas.overviewResultsSchema }
    },
    steps: [{ required: false, type: StepChemas.stepSchema }, { _id: false, id: false }],
}, {
    _id: false,
    id: false,
});
exports.scenarioTag = new mongoose_1.Schema({
    line: { required: false, type: Number },
    location: {
        column: { required: false, type: Number },
        line: { required: false, type: Number }
    },
    name: { required: false, type: String }
}, {
    _id: false,
    id: false,
});
exports.scenarioSchema = new mongoose_1.Schema({
    // Index: { required: false, type: Number },
    after: { required: false, type: exports.beforeOrAfterSchema },
    before: { required: false, type: exports.beforeOrAfterSchema },
    description: { required: false, type: String },
    examples: [[{ default: undefined, required: false, type: String }]],
    featureId: { ref: 'Features', type: mongoose_1.Schema.Types.ObjectId },
    id: String,
    isFirstScenarioOutline: { required: false, type: Boolean },
    keyword: { required: false, type: String },
    line: { required: false, type: Number },
    name: { required: false, type: String },
    reportId: mongoose_1.Schema.Types.ObjectId,
    results: exports.scenarioResultsSchema,
    // steps: [{ required: false, type: StepChemas.stepSchema }, { _id: false, id: false }],
    stepsId: mongoose_1.Schema.Types.ObjectId,
    tags: [{ required: false, type: exports.scenarioTag }],
    type: { required: false, type: String },
}, {
    // _id: false,
    // id: false,
    toJSON: {
        transform: (ret) => {
            delete ret._id;
        },
        versionKey: false,
        virtuals: true
    },
    toObject: {
        versionKey: false,
        virtuals: true
    }
});
exports.scenarioSchema.virtual('steps', {
    foreignField: 'scenarioId',
    justOne: false,
    localField: '_id',
    ref: 'Step',
});
//# sourceMappingURL=mongoose-scenario-schemas.js.map