function _ts_decorate(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;
}
function _ts_metadata(k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
}
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from "typeorm";
import { User } from "./user.js";
import { DriveFile } from "./drive-file.js";
import { id } from "../id.js";
import { UserGroup } from "./user-group.js";
export let MessagingMessage = class MessagingMessage {
    id;
    createdAt;
    userId;
    user;
    recipientId;
    recipient;
    groupId;
    group;
    text;
    isRead;
    uri;
    reads;
    fileId;
    file;
};
_ts_decorate([
    PrimaryColumn(id()),
    _ts_metadata("design:type", String)
], MessagingMessage.prototype, "id", void 0);
_ts_decorate([
    Index(),
    Column("timestamp with time zone", {
        comment: "The created date of the MessagingMessage."
    }),
    _ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
], MessagingMessage.prototype, "createdAt", void 0);
_ts_decorate([
    Index(),
    Column({
        ...id(),
        comment: "The sender user ID."
    }),
    _ts_metadata("design:type", Object)
], MessagingMessage.prototype, "userId", void 0);
_ts_decorate([
    ManyToOne((type)=>User, {
        onDelete: "CASCADE"
    }),
    JoinColumn(),
    _ts_metadata("design:type", Object)
], MessagingMessage.prototype, "user", void 0);
_ts_decorate([
    Index(),
    Column({
        ...id(),
        nullable: true,
        comment: "The recipient user ID."
    }),
    _ts_metadata("design:type", Object)
], MessagingMessage.prototype, "recipientId", void 0);
_ts_decorate([
    ManyToOne((type)=>User, {
        onDelete: "CASCADE"
    }),
    JoinColumn(),
    _ts_metadata("design:type", Object)
], MessagingMessage.prototype, "recipient", void 0);
_ts_decorate([
    Index(),
    Column({
        ...id(),
        nullable: true,
        comment: "The recipient group ID."
    }),
    _ts_metadata("design:type", Object)
], MessagingMessage.prototype, "groupId", void 0);
_ts_decorate([
    ManyToOne((type)=>UserGroup, {
        onDelete: "CASCADE"
    }),
    JoinColumn(),
    _ts_metadata("design:type", Object)
], MessagingMessage.prototype, "group", void 0);
_ts_decorate([
    Column("varchar", {
        length: 4096,
        nullable: true
    }),
    _ts_metadata("design:type", Object)
], MessagingMessage.prototype, "text", void 0);
_ts_decorate([
    Column("boolean", {
        default: false
    }),
    _ts_metadata("design:type", Boolean)
], MessagingMessage.prototype, "isRead", void 0);
_ts_decorate([
    Column("varchar", {
        length: 512,
        nullable: true
    }),
    _ts_metadata("design:type", Object)
], MessagingMessage.prototype, "uri", void 0);
_ts_decorate([
    Column({
        ...id(),
        array: true,
        default: "{}"
    }),
    _ts_metadata("design:type", Array)
], MessagingMessage.prototype, "reads", void 0);
_ts_decorate([
    Column({
        ...id(),
        nullable: true
    }),
    _ts_metadata("design:type", Object)
], MessagingMessage.prototype, "fileId", void 0);
_ts_decorate([
    ManyToOne((type)=>DriveFile, {
        onDelete: "CASCADE"
    }),
    JoinColumn(),
    _ts_metadata("design:type", Object)
], MessagingMessage.prototype, "file", void 0);
MessagingMessage = _ts_decorate([
    Entity()
], MessagingMessage);
