import NotificationMessage from "~/models/Core/NotificationMessage";
import {HasOne, Str, Uid, Attr} from "pinia-orm/dist/decorators";
import ApiModel from "~/models/ApiModel";

/**
 * AP2i Model : Notification
 *
 * @see https://gitlab.2iopenservice.com/opentalent/ap2i/-/blob/develop/src/Entity/Core/Notification.php
 */
export default class Notification extends ApiModel {
  static entity = 'notifications'

  @Uid()
  declare id: number | string | null

  @Str('')
  declare name: string

  @HasOne(() => NotificationMessage, 'id')
  declare message: NotificationMessage | null

  @Str(null)
  declare type: string|null

  @Str(null)
  declare link: string|null

  @Attr({})
  declare notificationUsers: Array<string>
}
