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

@Entity('room_calendar_logs')
export class RoomCalendarLog {
  @PrimaryGeneratedColumn({ type: 'bigint', unsigned: true })
  id: number;

  @Index()
  @Column({ name: 'room_id', type: 'bigint', unsigned: true, comment: '房型ID' })
  roomId: number;

  @Column({ name: 'operator_id', type: 'bigint', unsigned: true, comment: '操作人ID' })
  operatorId: number;

  @Column({ name: 'date_range', length: 100, comment: '变更日期范围' })
  dateRange: string;

  @Column({ name: 'change_type', type: 'enum', enum: ['price', 'stock', 'status'], comment: '变更类型' })
  changeType: 'price' | 'stock' | 'status';

  @Column({ name: 'old_value', length: 100, nullable: true, comment: '变更前值' })
  oldValue: string;

  @Column({ name: 'new_value', length: 100, nullable: true, comment: '变更后值' })
  newValue: string;

  @CreateDateColumn({ name: 'created_at', comment: '创建时间' })
  createdAt: Date;
}
