"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.ScheduledJob = void 0;
const openapi = require("@nestjs/swagger");
const typeorm_1 = require("typeorm");
const common_entity_1 = require("./common.entity");
const module_metadata_entity_1 = require("./module-metadata.entity");
let ScheduledJob = class ScheduledJob extends common_entity_1.CommonEntity {
    constructor() {
        super(...arguments);
        this.isActive = false;
    }
    static _OPENAPI_METADATA_FACTORY() {
        return { scheduleName: { required: true, type: () => String }, isActive: { required: true, type: () => Boolean, default: false }, frequency: { required: true, type: () => String }, startTime: { required: true, type: () => Date }, endTime: { required: true, type: () => Date }, startDate: { required: true, type: () => Date }, endDate: { required: true, type: () => Date }, dayOfMonth: { required: true, type: () => Number }, lastRunAt: { required: true, type: () => Date }, nextRunAt: { required: true, type: () => Date }, dayOfWeek: { required: true, type: () => String }, job: { required: true, type: () => String }, cronExpression: { required: true, type: () => String }, module: { required: true, type: () => require("./module-metadata.entity").ModuleMetadata } };
    }
};
exports.ScheduledJob = ScheduledJob;
__decorate([
    (0, typeorm_1.Index)({ unique: true }),
    (0, typeorm_1.Column)({ type: "varchar" }),
    __metadata("design:type", String)
], ScheduledJob.prototype, "scheduleName", void 0);
__decorate([
    (0, typeorm_1.Column)({ default: false }),
    __metadata("design:type", Boolean)
], ScheduledJob.prototype, "isActive", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "varchar" }),
    __metadata("design:type", String)
], ScheduledJob.prototype, "frequency", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "time", nullable: true }),
    __metadata("design:type", Date)
], ScheduledJob.prototype, "startTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "time", nullable: true }),
    __metadata("design:type", Date)
], ScheduledJob.prototype, "endTime", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "date", nullable: true }),
    __metadata("design:type", Date)
], ScheduledJob.prototype, "startDate", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "date", nullable: true }),
    __metadata("design:type", Date)
], ScheduledJob.prototype, "endDate", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "integer", nullable: true }),
    __metadata("design:type", Number)
], ScheduledJob.prototype, "dayOfMonth", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true }),
    __metadata("design:type", Date)
], ScheduledJob.prototype, "lastRunAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ nullable: true }),
    __metadata("design:type", Date)
], ScheduledJob.prototype, "nextRunAt", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "varchar", nullable: true }),
    __metadata("design:type", String)
], ScheduledJob.prototype, "dayOfWeek", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "varchar" }),
    __metadata("design:type", String)
], ScheduledJob.prototype, "job", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "varchar", nullable: true }),
    __metadata("design:type", String)
], ScheduledJob.prototype, "cronExpression", void 0);
__decorate([
    (0, typeorm_1.Index)(),
    (0, typeorm_1.ManyToOne)(() => module_metadata_entity_1.ModuleMetadata, { nullable: false }),
    (0, typeorm_1.JoinColumn)({ referencedColumnName: 'id' }),
    __metadata("design:type", module_metadata_entity_1.ModuleMetadata)
], ScheduledJob.prototype, "module", void 0);
exports.ScheduledJob = ScheduledJob = __decorate([
    (0, typeorm_1.Entity)('ss_scheduled_job')
], ScheduledJob);
//# sourceMappingURL=scheduled-job.entity.js.map