import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';

class ProjectCubit extends Cubit<String?> {
  final FlutterSecureStorage storage;
  static const String projectKey = "selected_project_uuid";

  ProjectCubit(this.storage) : super(null);

  Future<void> setProjectUUID(String newUUID) async {
    await storage.write(key: projectKey, value: newUUID);
    emit(newUUID);
  }

  Future<void> clearProjectUUID() async {
    await storage.delete(key: projectKey);
    emit(null);
  }
}
