import { DB_SCHEMA } from 'src/utils';
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity('offers', { schema: DB_SCHEMA })
export class OffersEntity {
  @PrimaryGeneratedColumn({ type: 'mediumint', name: 'id' })
  id: number;

  @Column('varchar', { name: 'subject', length: 100 })
  subject: string;

  @Column('text', { name: 'body' })
  body: string;

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

  @Column('smallint', { name: 'timezone_id' })
  timezone_id: number;

  @Column('char', { name: 'start_date', nullable: true, length: 20 })
  start_date: string | null;

  @Column('char', { name: 'startDateStr', nullable: true, length: 10 })
  startDateStr: string | null;

  @Column('char', { name: 'end_date', nullable: true, length: 20 })
  end_date: string | null;

  @Column('char', { name: 'endDateStr', nullable: true, length: 10 })
  endDateStr: string | null;

  @Column('smallint', { name: 'by_user', nullable: true })
  by_user: number | null;

  @Column('tinyint', { name: 'active', width: 1, default: () => "'0'" })
  active: boolean;

  @Column('timestamp', { name: 'created', default: () => 'CURRENT_TIMESTAMP' })
  created: Date;

  @Column('timestamp', { name: 'modified', default: () => 'CURRENT_TIMESTAMP' })
  modified: Date;
}
