import 'package:hmg_patient_app/generated/json/base/json_convert_content.dart';
import 'package:hmg_patient_app/generated/json/base/json_field.dart';

class GeoZonesResponseModel  extends JsonConvert<GeoZonesResponseModel> {
  @JSONField(name: "GEOF_ID")
  int? geofId;
  @JSONField(name: "Description")
  String? description;
  @JSONField(name: "DescriptionN")
  String? descriptionN;
  @JSONField(name: "Latitude")
  String? latitude;
  @JSONField(name: "Longitude")
  String? longitude;
  @JSONField(name: "Radius")
  int? radius;
  @JSONField(name: "Type")
  int? type;
  @JSONField(name: "ProjectID")
  int? projectID;
  @JSONField(name: "ImageURL")
  String? imageURL;
  @JSONField(name: "IsCity")
  bool? isCity;

  // Outside Server Response
  bool isRegistered = false;
  bool onEntry = true;
  bool onExit = true;

  String geofenceId() {
    return "$geofId\_${description!.replaceAll(" ", "")}";
  }

  static get(String coordinates, int radius, String name) {
    coordinates = coordinates.replaceAll(" ", "");
    var geo = GeoZonesResponseModel();
    geo.latitude = coordinates.split(",").first;
    geo.longitude = coordinates.split(",").last;
    geo.radius = radius;
    geo.description = name;
    return geo;
  }

  static GeoZonesResponseModel zkH() {
    var geo = GeoZonesResponseModel();
    geo.latitude = "24.691136";
    geo.longitude = "46.650116";
    geo.radius = 150;
    geo.description = "zkH";
    return geo;
  }

  static GeoZonesResponseModel csO() {
    var geo = GeoZonesResponseModel();
    geo.latitude = "24.7087913";
    geo.longitude = "46.6656461";
    geo.radius = 150;
    geo.description = "csO";
    return geo;
  }
}
