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);
};
import AIAgent from "./AIAgent";
import AIAgentTask from "./AIAgentTask";
import Project from "./Project";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import { PlanType } from "../../Types/Billing/SubscriptionPlan";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import Permission from "../../Types/Permission";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
import LogSeverity from "../../Types/Log/LogSeverity";
let AIAgentTaskLog = class AIAgentTaskLog extends BaseModel {
    constructor() {
        super(...arguments);
        this.project = undefined;
        this.projectId = undefined;
        this.aiAgentTask = undefined;
        this.aiAgentTaskId = undefined;
        this.aiAgent = undefined;
        this.aiAgentId = undefined;
        this.severity = undefined;
        this.message = undefined;
        this.deletedByUser = undefined;
        this.deletedByUserId = undefined;
        this.createdByUser = undefined;
        this.createdByUserId = undefined;
    }
};
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.CreateProjectAIAgentTask,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProjectAIAgentTask,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Entity,
        required: true,
        modelType: Project,
        manyToOneRelationColumn: "projectId",
        title: "Project",
        description: "Project this log belongs to.",
    }),
    ManyToOne(() => {
        return Project;
    }, {
        cascade: false,
        eager: false,
        nullable: false,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "projectId" }),
    __metadata("design:type", Project)
], AIAgentTaskLog.prototype, "project", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.CreateProjectAIAgentTask,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProjectAIAgentTask,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: true,
        canReadOnRelationQuery: true,
        title: "Project ID",
        description: "ID of the project this log belongs to.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: false,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], AIAgentTaskLog.prototype, "projectId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.CreateProjectAIAgentTask,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProjectAIAgentTask,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Entity,
        required: true,
        modelType: AIAgentTask,
        manyToOneRelationColumn: "aiAgentTaskId",
        title: "AI Agent Task",
        description: "AI Agent Task this log belongs to.",
    }),
    ManyToOne(() => {
        return AIAgentTask;
    }, {
        cascade: false,
        eager: false,
        nullable: false,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "aiAgentTaskId" }),
    __metadata("design:type", AIAgentTask)
], AIAgentTaskLog.prototype, "aiAgentTask", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.CreateProjectAIAgentTask,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProjectAIAgentTask,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: true,
        canReadOnRelationQuery: true,
        title: "AI Agent Task ID",
        description: "ID of the AI Agent Task this log belongs to.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: false,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], AIAgentTaskLog.prototype, "aiAgentTaskId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.CreateProjectAIAgentTask,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProjectAIAgentTask,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Entity,
        required: true,
        modelType: AIAgent,
        manyToOneRelationColumn: "aiAgentId",
        title: "AI Agent",
        description: "AI Agent that generated this log.",
    }),
    ManyToOne(() => {
        return AIAgent;
    }, {
        cascade: false,
        eager: false,
        nullable: false,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "aiAgentId" }),
    __metadata("design:type", AIAgent)
], AIAgentTaskLog.prototype, "aiAgent", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.CreateProjectAIAgentTask,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProjectAIAgentTask,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: true,
        canReadOnRelationQuery: true,
        title: "AI Agent ID",
        description: "ID of the AI Agent that generated this log.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: false,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], AIAgentTaskLog.prototype, "aiAgentId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.CreateProjectAIAgentTask,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProjectAIAgentTask,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.EditProjectAIAgentTask,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.ShortText,
        title: "Severity",
        description: "Severity level of this log entry (e.g., Information, Warning, Error).",
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: 50,
    }),
    __metadata("design:type", String)
], AIAgentTaskLog.prototype, "severity", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.CreateProjectAIAgentTask,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProjectAIAgentTask,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.EditProjectAIAgentTask,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.VeryLongText,
        title: "Message",
        description: "The log message content.",
    }),
    Column({
        nullable: false,
        type: ColumnType.VeryLongText,
    }),
    __metadata("design:type", String)
], AIAgentTaskLog.prototype, "message", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Entity, modelType: User }),
    ManyToOne(() => {
        return User;
    }, {
        cascade: false,
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "deletedByUserId" }),
    __metadata("design:type", User)
], AIAgentTaskLog.prototype, "deletedByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Deleted by User ID",
        description: "User ID who deleted this object (if this object was deleted by a User)",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], AIAgentTaskLog.prototype, "deletedByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [Permission.ProjectOwner, Permission.ProjectAdmin],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Entity, modelType: User }),
    ManyToOne(() => {
        return User;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "createdByUserId" }),
    __metadata("design:type", User)
], AIAgentTaskLog.prototype, "createdByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [Permission.ProjectOwner, Permission.ProjectAdmin],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Created by User ID",
        description: "User ID who created this object (if this object was created by a User)",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], AIAgentTaskLog.prototype, "createdByUserId", void 0);
AIAgentTaskLog = __decorate([
    EnableDocumentation(),
    TableBillingAccessControl({
        create: PlanType.Growth,
        read: PlanType.Growth,
        update: PlanType.Growth,
        delete: PlanType.Growth,
    }),
    TenantColumn("projectId"),
    CrudApiEndpoint(new Route("/ai-agent-task-log")),
    Entity({
        name: "AIAgentTaskLog",
    }),
    TableMetadata({
        tableName: "AIAgentTaskLog",
        singularName: "AI Agent Task Log",
        pluralName: "AI Agent Task Logs",
        icon: IconProp.Logs,
        tableDescription: "Logs generated by AI agents during task execution. Contains detailed log entries with severity, timestamp, and messages.",
    }),
    TableAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.CreateProjectAIAgentTask,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProjectAIAgentTask,
        ],
        delete: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.DeleteProjectAIAgentTask,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.EditProjectAIAgentTask,
        ],
    })
], AIAgentTaskLog);
export default AIAgentTaskLog;
//# sourceMappingURL=AIAgentTaskLog.js.map