import 'package:flutter/cupertino.dart';

enum Environment { dev, prod }
class AppConfig extends InheritedWidget{
  final Environment environment;
  final String BaseURL;
  final String URL;
  final String URLDOC;
  final String URL_IMAGE;
  final String tokenEndpoint;
  final String authorizationEndpoint;
  final String issuer;
  // 4
  const AppConfig({
    Key? key,
    required Widget child,
    required this.environment,
    required this.BaseURL,
    required this.URL,
    required this.URLDOC,
    required this.URL_IMAGE,
    required this.tokenEndpoint,
    required this.authorizationEndpoint,
    required this.issuer
  }) : super(
    key: key,
    child: child,
  );

  // 5
  static AppConfig of(BuildContext context) {
    return context.dependOnInheritedWidgetOfExactType<AppConfig>()!;
  }

  // 6
  @override
  bool updateShouldNotify(covariant InheritedWidget oldWidget) => false;

}

enum DeviceType { Phone, Tablet }

DeviceType getDeviceType() {
  final data = MediaQueryData.fromWindow(WidgetsBinding.instance.window);
  return data.size.shortestSide < 550 ? DeviceType.Phone : DeviceType.Tablet;
}