import '../models/pronunciation_item.dart';

/// 发音练习静态数据
class PronunciationData {
  static final List<PronunciationItem> _wordPronunciation = [
    PronunciationItem(
      id: 'word_001',
      text: 'pronunciation',
      phonetic: '/prəˌnʌnsiˈeɪʃn/',
      audioUrl: 'assets/audio/pronunciation.mp3',
      type: PronunciationType.word,
      difficulty: DifficultyLevel.intermediate,
      category: '学习词汇',
      tips: [
        '注意重音在第四个音节',
        '末尾的-tion读作/ʃn/',
        '中间的nun要清晰发音'
      ],
      createdAt: DateTime.now(),
    ),
    PronunciationItem(
      id: 'word_002',
      text: 'communication',
      phonetic: '/kəˌmjuːnɪˈkeɪʃn/',
      audioUrl: 'assets/audio/communication.mp3',
      type: PronunciationType.word,
      difficulty: DifficultyLevel.intermediate,
      category: '商务词汇',
      tips: [
        '重音在第五个音节',
        '注意/mju:/的发音',
        '末尾-tion读作/ʃn/'
      ],
      createdAt: DateTime.now(),
    ),
    PronunciationItem(
      id: 'word_003',
      text: 'restaurant',
      phonetic: '/ˈrestərɑːnt/',
      audioUrl: 'assets/audio/restaurant.mp3',
      type: PronunciationType.word,
      difficulty: DifficultyLevel.beginner,
      category: '日常词汇',
      tips: [
        '重音在第一个音节',
        '注意/r/音的发音',
        '末尾的t通常不发音'
      ],
      createdAt: DateTime.now(),
    ),
    PronunciationItem(
      id: 'word_004',
      text: 'schedule',
      phonetic: '/ˈʃedjuːl/',
      audioUrl: 'assets/audio/schedule.mp3',
      type: PronunciationType.word,
      difficulty: DifficultyLevel.intermediate,
      category: '工作词汇',
      tips: [
        '英式发音以/ʃ/开头',
        '美式发音以/sk/开头',
        '重音在第一个音节'
      ],
      createdAt: DateTime.now(),
    ),
    PronunciationItem(
      id: 'word_005',
      text: 'comfortable',
      phonetic: '/ˈkʌmftəbl/',
      audioUrl: 'assets/audio/comfortable.mp3',
      type: PronunciationType.word,
      difficulty: DifficultyLevel.advanced,
      category: '形容词',
      tips: [
        '注意弱读音节',
        '中间的or通常省略',
        '末尾的-able读作/əbl/'
      ],
      createdAt: DateTime.now(),
    ),
  ];

  static final List<PronunciationItem> _sentencePronunciation = [
    PronunciationItem(
      id: 'sentence_001',
      text: 'How are you doing today?',
      phonetic: '/haʊ ɑːr juː ˈduːɪŋ təˈdeɪ/',
      audioUrl: 'assets/audio/how_are_you.mp3',
      type: PronunciationType.sentence,
      difficulty: DifficultyLevel.beginner,
      category: '日常问候',
      tips: [
        '注意连读：How are → /haʊər/',
        '语调上扬表示疑问',
        'today重音在第二个音节'
      ],
      createdAt: DateTime.now(),
    ),
    PronunciationItem(
      id: 'sentence_002',
      text: 'Could you please help me with this?',
      phonetic: '/kʊd juː pliːz help miː wɪð ðɪs/',
      audioUrl: 'assets/audio/could_you_help.mp3',
      type: PronunciationType.sentence,
      difficulty: DifficultyLevel.intermediate,
      category: '请求帮助',
      tips: [
        '礼貌的语调，温和下降',
        '注意could的弱读',
        'with this连读'
      ],
      createdAt: DateTime.now(),
    ),
    PronunciationItem(
      id: 'sentence_003',
      text: 'I would like to make a reservation.',
      phonetic: '/aɪ wʊd laɪk tuː meɪk ə ˌrezərˈveɪʃn/',
      audioUrl: 'assets/audio/reservation.mp3',
      type: PronunciationType.sentence,
      difficulty: DifficultyLevel.intermediate,
      category: '预订服务',
      tips: [
        '正式语调，清晰发音',
        'would like连读',
        'reservation重音在第三个音节'
      ],
      createdAt: DateTime.now(),
    ),
    PronunciationItem(
      id: 'sentence_004',
      text: 'The weather is absolutely beautiful today.',
      phonetic: '/ðə ˈweðər ɪz ˌæbsəˈluːtli ˈbjuːtɪfl təˈdeɪ/',
      audioUrl: 'assets/audio/weather_beautiful.mp3',
      type: PronunciationType.sentence,
      difficulty: DifficultyLevel.advanced,
      category: '天气描述',
      tips: [
        '注意节奏和重音分布',
        'absolutely的重音模式',
        '形容词的语调变化'
      ],
      createdAt: DateTime.now(),
    ),
    PronunciationItem(
      id: 'sentence_005',
      text: 'I am looking forward to hearing from you.',
      phonetic: '/aɪ æm ˈlʊkɪŋ ˈfɔːrwərd tuː ˈhɪrɪŋ frəm juː/',
      audioUrl: 'assets/audio/looking_forward.mp3',
      type: PronunciationType.sentence,
      difficulty: DifficultyLevel.advanced,
      category: '商务表达',
      tips: [
        '正式商务语调',
        '注意短语的完整性',
        'forward to连读'
      ],
      createdAt: DateTime.now(),
    ),
  ];

  static final List<PronunciationItem> _phrasePronunciation = [
    PronunciationItem(
      id: 'phrase_001',
      text: 'Nice to meet you',
      phonetic: '/naɪs tuː miːt juː/',
      audioUrl: 'assets/audio/nice_to_meet.mp3',
      type: PronunciationType.phrase,
      difficulty: DifficultyLevel.beginner,
      category: '问候语',
      tips: [
        '连读：Nice to → /naɪstə/',
        '友好的语调',
        '重音在Nice和meet上'
      ],
      createdAt: DateTime.now(),
    ),
    PronunciationItem(
      id: 'phrase_002',
      text: 'Thank you very much',
      phonetic: '/θæŋk juː ˈveri mʌtʃ/',
      audioUrl: 'assets/audio/thank_you_much.mp3',
      type: PronunciationType.phrase,
      difficulty: DifficultyLevel.beginner,
      category: '感谢语',
      tips: [
        '注意th音的发音',
        'very much重音分布',
        '真诚的语调'
      ],
      createdAt: DateTime.now(),
    ),
    PronunciationItem(
      id: 'phrase_003',
      text: 'Excuse me',
      phonetic: '/ɪkˈskjuːz miː/',
      audioUrl: 'assets/audio/excuse_me.mp3',
      type: PronunciationType.phrase,
      difficulty: DifficultyLevel.beginner,
      category: '礼貌用语',
      tips: [
        '重音在excuse的第二个音节',
        '礼貌的上升语调',
        '清晰的/z/音'
      ],
      createdAt: DateTime.now(),
    ),
  ];

  static final List<PronunciationItem> _phonemePronunciation = [
    PronunciationItem(
      id: 'phoneme_001',
      text: '/θ/ - think, three, thank',
      phonetic: '/θ/',
      audioUrl: 'assets/audio/th_sound.mp3',
      type: PronunciationType.phoneme,
      difficulty: DifficultyLevel.intermediate,
      category: '辅音',
      tips: [
        '舌尖轻触上齿',
        '气流从舌齿间通过',
        '不要发成/s/或/f/'
      ],
      createdAt: DateTime.now(),
    ),
    PronunciationItem(
      id: 'phoneme_002',
      text: '/r/ - red, right, very',
      phonetic: '/r/',
      audioUrl: 'assets/audio/r_sound.mp3',
      type: PronunciationType.phoneme,
      difficulty: DifficultyLevel.advanced,
      category: '辅音',
      tips: [
        '舌尖向上卷起',
        '不要触碰口腔任何部位',
        '声带振动'
      ],
      createdAt: DateTime.now(),
    ),
    PronunciationItem(
      id: 'phoneme_003',
      text: '/æ/ - cat, hat, bad',
      phonetic: '/æ/',
      audioUrl: 'assets/audio/ae_sound.mp3',
      type: PronunciationType.phoneme,
      difficulty: DifficultyLevel.intermediate,
      category: '元音',
      tips: [
        '嘴巴张得比/e/大',
        '舌位较低',
        '短元音，发音清脆'
      ],
      createdAt: DateTime.now(),
    ),
  ];

  /// 获取所有发音练习项目
  static List<PronunciationItem> getAllItems() {
    return [
      ..._wordPronunciation,
      ..._sentencePronunciation,
      ..._phrasePronunciation,
      ..._phonemePronunciation,
    ];
  }

  /// 根据类型获取发音练习项目
  static List<PronunciationItem> getItemsByType(PronunciationType type) {
    switch (type) {
      case PronunciationType.word:
        return _wordPronunciation;
      case PronunciationType.sentence:
        return _sentencePronunciation;
      case PronunciationType.phrase:
        return _phrasePronunciation;
      case PronunciationType.phoneme:
        return _phonemePronunciation;
    }
  }

  /// 根据难度获取发音练习项目
  static List<PronunciationItem> getItemsByDifficulty(DifficultyLevel difficulty) {
    return getAllItems().where((item) => item.difficulty == difficulty).toList();
  }

  /// 根据分类获取发音练习项目
  static List<PronunciationItem> getItemsByCategory(String category) {
    return getAllItems().where((item) => item.category == category).toList();
  }

  /// 根据ID获取发音练习项目
  static PronunciationItem? getItemById(String id) {
    try {
      return getAllItems().firstWhere((item) => item.id == id);
    } catch (e) {
      return null;
    }
  }

  /// 获取所有分类
  static List<String> getAllCategories() {
    return getAllItems().map((item) => item.category).toSet().toList();
  }
}