import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity('email_settings')
export class EmailSettingsEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  smtp_host: string;

  @Column()
  smtp_port: number;

  @Column()
  smtp_username: string;

  @Column()
  smtp_password: string;

  /** 'ssl' (implicit TLS, port 465) or 'tls' (STARTTLS, port 587) */
  @Column()
  smtp_encryption: string;

  @Column()
  from_email: string;

  @Column({ nullable: true })
  from_name: string;

  /** User this sender belongs to. NULL = generic / unassigned. */
  @Column({ type: 'int', nullable: true })
  user_id: number | null;

   // 👇 NEW — which brand this mailbox represents (QRS or TQS)
  @Column({ type: 'enum', enum: ['QRS', 'TQS'], nullable: true, default: null })
  scheme: 'QRS' | 'TQS' | null;

  @CreateDateColumn()
  created_at: Date;

  @UpdateDateColumn()
  updated_at: Date;
}
