import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/utils/enums.dart';

class SpecialServiceModel {
  int? id;
  String? name;
  String? description;
  double? price;
  int? specialServiceType;
  String? specialServiceTypeName;
  bool? isActive;
  String? startDate;
  String? endDate;
  List<Details>? details;
  List<Office>? office;
  bool? isDelivery;
  bool? isSelected;

  SpecialServiceModel(
      {this.id,
      this.name,
      this.description,
      this.price,
      this.specialServiceType,
      this.specialServiceTypeName,
      this.isActive,
      this.startDate,
      this.endDate,
      this.details,
      this.office,
      this.isSelected,
      this.isDelivery});

  SpecialServiceModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    description = json['description'];
    price = json['price'];
    specialServiceType = json['specialServiceType'];
    specialServiceTypeName = json['specialServiceTypeName'];
    isActive = json['isActive'];
    startDate = json['startDate'];
    endDate = json['endDate'];
    if (json['details'] != null) {
      details = <Details>[];
      json['details'].forEach((v) {
        details!.add(Details.fromJson(v));
      });
    }
    if (json['office'] != null) {
      office = <Office>[];
      json['office'].forEach((v) {
        office!.add(Office.fromJson(v));
      });
    }
    isDelivery = json['isDelivery'];
    isSelected = false;
  }
}

class Details {
  int? id;
  int? specialServiceID;
  int? fromcity;
  int? tocity;
  int? price;

  Details({this.id, this.specialServiceID, this.fromcity, this.tocity, this.price});

  Details.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    specialServiceID = json['specialServiceID'];
    fromcity = json['fromcity'];
    tocity = json['tocity'];
    price = json['price'];
  }
}

class Office {
  int? id;
  String? officeAreaName;
  String? officeAreaNameN;
  int? cityID;
  CitySSModel? city;
  int? specialServiceID;

  Office({this.id, this.officeAreaName, this.officeAreaNameN, this.cityID, this.city, this.specialServiceID});

  Office.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    officeAreaName = json['officeAreaName'];
    officeAreaNameN = json['officeAreaNameN'];
    cityID = json['cityID'];
    if (json['city'] != null) {
      city = json['city'] != null ? CitySSModel.fromJson(json['city']) : null;
    }
    specialServiceID = json['specialServiceID'];
  }
}

class CitySSModel {
  int? id;
  String? cityName;
  String? cityNameN;
  int? countryID;
  String? country;
  bool? isActive;
  int? createdBy;
  String? createdOn;
  String? modifiedBy;
  String? modifiedOn;

  CitySSModel({this.id, this.cityName, this.cityNameN, this.countryID, this.country, this.isActive, this.createdBy, this.createdOn, this.modifiedBy, this.modifiedOn});

  CitySSModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    cityName = json['cityName'];
    cityNameN = json['cityNameN'];
    countryID = json['countryID'];
    country = json['country'];
    isActive = json['isActive'];
    createdBy = json['createdBy'];
    createdOn = json['createdOn'];
    modifiedBy = json['modifiedBy'];
    modifiedOn = json['modifiedOn'];
  }
}

class SpecialServiceModelForAds {
  int? adsID;
  int? specialServiceID;
  String? name;
  String? description;
  double? price;
  AppointmentStatusEnum? appointmentStatusEnum;
  int? appointmentStatusId;
  String? appointmentDate;

  SpecialServiceModelForAds({
    this.adsID,
    this.specialServiceID,
    this.name,
    this.description,
    this.price,
    this.appointmentStatusEnum,
    this.appointmentDate,
    this.appointmentStatusId,
  });

  SpecialServiceModelForAds.fromJson(Map<String, dynamic> json) {
    adsID = json['adsID'];
    specialServiceID = json['specialServiceID'];
    name = json['name'];
    description = json['description'];
    price = json['price'];
    appointmentStatusEnum = (json['appointmentStatus'] as int).toAppointmentStatusEnum();
    appointmentDate = json['appointmentDate'];
    appointmentStatusId = json['appointmentStatus'];
  }

  @override
  String toString() {
    return 'SpecialServiceModelForAds{adsID: $adsID, specialServiceID: $specialServiceID, name: $name, description: $description, price: $price, appointmentStatusEnum: $appointmentStatusEnum, appointmentStatusId: $appointmentStatusId, appointmentDate: $appointmentDate}';
  }
}
