/**
 * Notification ORM Entity
 */

import { Entity, PrimaryColumn, Column, CreateDateColumn, Index } from 'typeorm';

@Entity('notifications')
@Index(['user_id', 'read', 'created_at'])
@Index(['organization_id', 'created_at'])
@Index(['user_id', 'created_at'])
export class NotificationOrmEntity {
  @PrimaryColumn('uuid')
  id: string;

  @Column('uuid')
  user_id: string;

  @Column('uuid')
  organization_id: string;

  @Column('varchar', { length: 50 })
  type: string;

  @Column('varchar', { length: 20 })
  priority: string;

  @Column('varchar', { length: 255 })
  title: string;

  @Column('text')
  message: string;

  @Column('jsonb', { nullable: true })
  metadata?: Record<string, any>;

  @Column('boolean', { default: false })
  read: boolean;

  @Column('timestamp', { nullable: true })
  read_at?: Date;

  @Column('varchar', { length: 500, nullable: true })
  action_url?: string;

  @CreateDateColumn()
  created_at: Date;
}
