
import '../models/wayz_common_models.dart';

class WzLocationOption {

  final String apiKey;
  final int interval;
  final bool isLocateOnce;

  WzLocationOption({
    required this.apiKey,
    required this.interval,
    required this.isLocateOnce,
  });

  factory WzLocationOption.fromJson(Map<String, dynamic> json) {
    return WzLocationOption(
      apiKey: WzJson.toStringOrNull(json['apiKey'])??'',
      interval: WzJson.toInt(json['interval']) ?? 5000,
      isLocateOnce: WzJson.toBool(json['isLocateOnce']) ?? false,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      "apiKey":apiKey,
      "interval":interval,
      "isLocateOnce":isLocateOnce,
    };
  }
}
