import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';

@Entity('date_notes')
@Index(['code', 'noteDate'], { unique: true })
export class DateNotes {
  @PrimaryGeneratedColumn({ unsigned: true })
  id!: number;

  @Column({ name: 'code', type: 'varchar', length: 255, nullable: false, comment: '股票代码' })
  code!: string;

  @Column({ name: 'note_date', type: 'timestamp', nullable: false, comment: '备注日期' })
  noteDate!: Date;

  @Column({ name: 'note', type: 'varchar', length: 255, nullable: false, comment: '备注内容' })
  note!: string;

  @Column({ name: 'created_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
  createdAt!: Date;

  @Column({ name: 'updated_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP' })
  updatedAt!: Date;
}