import 'dart:io';
import 'package:injectable/injectable.dart';
import 'package:cinema/common/env_not_found_exception.dart';

const apiKey = "apiKey";

@module
abstract class EnvModule {
  @lazySingleton
  @Named(apiKey)
  String get api_key {
    final key = Platform.environment['TMDB_API_KEY'];
    if (key == null || key.isEmpty) {
      throw EnvNotFoundException('TMDB_API_KEY environment variable is missing.');
    }
    return key;
  }
}
