// 杂货店（室内 15×10）：货架（T5 清点；C5 同一商品重复 9 格，D2 起）

import { MapScene } from './MapScene';
import { director } from '../core/CorruptionDirector';
import { audio } from '../audio/AudioEngine';
import { CLUES } from '../data/clues';
import { SHELF_COUNT_LINES, SHELF_COUNT_DONE } from '../data/dialogues';

export class ShopScene extends MapScene {
  readonly mapKey = 'shop';

  constructor() {
    super('ShopScene');
  }

  protected async onInteract(id: string): Promise<boolean> {
    if (id === 'shelf_count') {
      if (director.isTaskActive('T5')) {
        await this.say({ lines: SHELF_COUNT_LINES });
        director.addClue('C5'); // 清点中发现：同一商品重复 9 格、标签空白
        await this.say({ speakerId: 'mimi', lines: SHELF_COUNT_DONE });
        director.completeTask('T5');
        audio.ding();
      } else if (director.day >= 2) {
        director.addClue('C5');
        await this.say({ lines: CLUES.C5.lines });
      } else {
        await this.say({ lines: ['货架整整齐齐，摆满了罐头。'] });
      }
      return true;
    }
    return false;
  }
}
