import { Column, Entity, PrimaryColumn } from 'typeorm';

@Entity('room_decor_layout_state')
export class RoomDecorLayoutState {
  @PrimaryColumn({ type: 'bigint', comment: '关联users.id' })
  user_id: bigint;

  @Column({ type: 'int', unsigned: true, nullable: false, default: 0, comment: '当前布局版本' })
  revision: number;

  @Column({ type: 'varchar', length: 64, nullable: true, comment: '最后一次幂等mutation ID' })
  last_mutation_id: string | null;

  @Column({ type: 'varchar', length: 120, nullable: true, comment: '最后一次mutation作用域' })
  last_mutation_scope: string | null;

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