class Tenant {
  final String id;
  final String name;
  final String email;
  final String? domainName;
  final String contactName;
  final String contactNumber;
  final String? logoImage;
  final String? organizationSize;
  final Industry? industry;
  final TenantStatus? tenantStatus;

  Tenant({
    required this.id,
    required this.name,
    required this.email,
    this.domainName,
    required this.contactName,
    required this.contactNumber,
    this.logoImage,
    this.organizationSize,
    this.industry,
    this.tenantStatus,
  });

  factory Tenant.fromJson(Map<String, dynamic> json) {
    return Tenant(
      id: json['id'] ?? '',
      name: json['name'] ?? '',
      email: json['email'] ?? '',
      domainName: json['domainName'] as String?,
      contactName: json['contactName'] ?? '',
      contactNumber: json['contactNumber'] ?? '',
      logoImage: json['logoImage'] is String ? json['logoImage'] : null,
      organizationSize: json['organizationSize'] is String
          ? json['organizationSize']
          : null,
      industry: json['industry'] != null
          ? Industry.fromJson(json['industry'])
          : null,
      tenantStatus: json['tenantStatus'] != null
          ? TenantStatus.fromJson(json['tenantStatus'])
          : null,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'name': name,
      'email': email,
      'domainName': domainName,
      'contactName': contactName,
      'contactNumber': contactNumber,
      'logoImage': logoImage,
      'organizationSize': organizationSize,
      'industry': industry?.toJson(),
      'tenantStatus': tenantStatus?.toJson(),
    };
  }
}

class Industry {
  final String id;
  final String name;

  Industry({
    required this.id,
    required this.name,
  });

  factory Industry.fromJson(Map<String, dynamic> json) {
    return Industry(
      id: json['id'] ?? '',
      name: json['name'] ?? '',
    );
  }

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

class TenantStatus {
  final String id;
  final String name;

  TenantStatus({
    required this.id,
    required this.name,
  });

  factory TenantStatus.fromJson(Map<String, dynamic> json) {
    return TenantStatus(
      id: json['id'] ?? '',
      name: json['name'] ?? '',
    );
  }

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