import 'package:get/get.dart';

class FAQModel {
  String? status;
  int? statusCode;
  String? message;
  List<Data>? data;

  FAQModel({this.status, this.statusCode, this.message, this.data});

  FAQModel.fromJson(Map<String, dynamic> json) {
    status = json['status'];
    statusCode = json['status_code'];
    message = json['message'];
    if (json['data'] != null) {
      data = <Data>[];
      json['data'].forEach((v) {
        data!.add(Data.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['status'] = status;
    data['status_code'] = statusCode;
    data['message'] = message;
    if (this.data != null) {
      data['data'] = this.data!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Data {
  int? id;
  String? categoryName;
  String? isActive;
  String? createdBy;
  String? modifiedBy;
  String? deletedAt;
  String? createdAt;
  String? updatedAt;
  List<FaqQueAns>? faqQueAns;

  Data(
      {this.id,
      this.categoryName,
      this.isActive,
      this.createdBy,
      this.modifiedBy,
      this.deletedAt,
      this.createdAt,
      this.updatedAt,
      this.faqQueAns});

  Data.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    categoryName = json['category_name'];
    isActive = json['is_active'];
    createdBy = json['created_by'] ?? "";
    modifiedBy = json['modified_by'] ?? "";
    deletedAt = json['deleted_at'] ?? "";
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
    if (json['faq_que_ans'] != null) {
      faqQueAns = <FaqQueAns>[];
      json['faq_que_ans'].forEach((v) {
        faqQueAns!.add(FaqQueAns.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['category_name'] = categoryName;
    data['is_active'] = isActive;
    data['created_by'] = createdBy;
    data['modified_by'] = modifiedBy;
    data['deleted_at'] = deletedAt;
    data['created_at'] = createdAt;
    data['updated_at'] = updatedAt;
    if (faqQueAns != null) {
      data['faq_que_ans'] = faqQueAns!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class FaqQueAns {
  int? id;
  int? faqMasterId;
  String? faqQuestion;
  String? faqAnswer;
  String? isActive;
  String? createdBy;
  String? modifiedBy;
  String? deletedAt;
  String? createdAt;
  String? updatedAt;
  List<UserLikes>? userLikes;

  FaqQueAns(
      {this.id,
      this.faqMasterId,
      this.faqQuestion,
      this.faqAnswer,
      this.isActive,
      this.createdBy,
      this.modifiedBy,
      this.deletedAt,
      this.createdAt,
      this.updatedAt,
      this.userLikes});

  FaqQueAns.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    faqMasterId = json['faq_master_id'];
    faqQuestion = json['faq_question'];
    faqAnswer = json['faq_answer'];
    isActive = json['is_active'];
    createdBy = json['created_by'] ?? "";
    modifiedBy = json['modified_by'] ?? "";
    deletedAt = json['deleted_at'] ?? "";
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
    if (json['user_likes'] != null) {
      userLikes = <UserLikes>[];
      json['user_likes'].forEach((v) {
        userLikes!.add(UserLikes.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['faq_master_id'] = faqMasterId;
    data['faq_question'] = faqQuestion;
    data['faq_answer'] = faqAnswer;
    data['is_active'] = isActive;
    data['created_by'] = createdBy;
    data['modified_by'] = modifiedBy;
    data['deleted_at'] = deletedAt;
    data['created_at'] = createdAt;
    data['updated_at'] = updatedAt;
    if (userLikes != null) {
      data['user_likes'] = userLikes!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class UserLikes {
  int? id;
  int? userId;
  int? faqId;
  int? status; //RxInt? status;
  String? isActive;

  String? createdAt;
  String? updatedAt;

  UserLikes(
      {this.id,
      this.userId,
      this.faqId,
      this.status,
      this.isActive,
      this.createdAt,
      this.updatedAt});

  UserLikes.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    userId = json['user_id'];
    faqId = json['faq_id'];
    status = (json['status']); // RxInt(json['status']);
    isActive = json['is_active'];

    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['user_id'] = userId;
    data['faq_id'] = faqId;
    data['status'] = status;
    data['is_active'] = isActive;

    data['created_at'] = createdAt;
    data['updated_at'] = updatedAt;
    return data;
  }
}
