import { Entity, Enum, ManyToOne, Property } from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
import { ContactScope, ContactStatusEnum } from '../interface/interface';
import { Restaurant } from '../../restaurants/entities/restaurant.entity';

@Entity({ tableName: 'contacts' })
export class Contact extends BaseEntity {
  @Property({ nullable: true })
  subject?: string | null = null;

  @Property()
  content!: string;

  @Property({ nullable: true })
  phone?: string | null = null;

  @Enum(() => ContactScope)
  scope: ContactScope

  @ManyToOne(() => Restaurant, { nullable: true })
  restaurant?: Restaurant | null = null;
 

  @Property({ default: ContactStatusEnum.New })
  status: ContactStatusEnum = ContactStatusEnum.New;
}
