import 'package:test_sa/extensions/enum_extensions.dart';

class ArrivalVerificationTypeModel {
  List<ArrivalTypeData>? data;
  String? message;
  String? title;
  String? innerMessage;
  int? responseCode;
  bool? isSuccess;

  ArrivalVerificationTypeModel({this.data, this.message, this.title, this.innerMessage, this.responseCode, this.isSuccess});

  ArrivalVerificationTypeModel.fromJson(Map<String, dynamic> json) {
    if (json['data'] != null) {
      data = <ArrivalTypeData>[];
      json['data'].forEach((v) {
        data!.add(ArrivalTypeData.fromJson(v));
      });
    }
    message = json['message'];
    title = json['title'];
    innerMessage = json['innerMessage'];
    responseCode = json['responseCode'];
    isSuccess = json['isSuccess'];
  }
}

class ArrivalTypeData {
  int? assetGroupId;
  int? verificationTypeId;
  VerificationTypes? verificationTypes;
  int? id;

  String? description;
  String? createdBy;
  String? createdDate;
  dynamic modifiedBy;
  dynamic modifiedDate;

  ArrivalTypeData({this.assetGroupId, this.verificationTypeId, this.verificationTypes, this.id, this.description, this.createdBy, this.createdDate, this.modifiedBy, this.modifiedDate});

  ArrivalTypeData.fromJson(Map<String, dynamic> json) {
    assetGroupId = json['assetGroupId'];
    verificationTypeId = json['verificationTypeId'];
    verificationTypes = json['verificationTypes'] != null ? VerificationTypes.fromJson(json['verificationTypes']) : null;
    id = json['id'];
    description = json['description'];
    createdBy = json['createdBy'];
    createdDate = json['createdDate'];
    modifiedBy = json['modifiedBy'];
    modifiedDate = json['modifiedDate'];
  }

  Map<String, dynamic> toJson() {
    return {
      'assetGroupId': assetGroupId,
      'verificationTypeId': verificationTypeId,
      'verificationTypes': verificationTypes?.toJson(),
      'id': id,
      'createdBy': createdBy,
      'createdDate': createdDate,
      'description': description,
      'modifiedBy': modifiedBy,
      'modifiedDate': modifiedDate,
    };
  }
}

class VerificationTypes {
  int? id;
  String? name;
  int? value;
  String? icon;

  VerificationTypes({this.id, this.name, this.value, this.icon});

  VerificationTypes.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    value = json['value'];
    icon = (json['value'] as int).getVerificationIconByValue();
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'name': name,
      'value': value,
    };
  }
}
