import 'package:unit2/model/rbac/rbac.dart'; import '../roles/pass_check/assign_role_area_type.dart'; class UserAssignedArea { final AssignedRole? assignedRole; final AssignRoleAreaType? assignedRoleAreaType; final dynamic assignedArea; UserAssignedArea({ required this.assignedRole, required this.assignedRoleAreaType, required this.assignedArea, }); factory UserAssignedArea.fromJson(Map json) => UserAssignedArea( assignedRole: json['assigned_role'] == null? null: AssignedRole.fromJson(json["assigned_role"]), assignedRoleAreaType: json['assigned_role_area_type'] == null? null : AssignRoleAreaType.fromJson(json["assigned_role_area_type"]), assignedArea: json["assigned_area"], ); Map toJson() => { "assigned_role": assignedRole?.toJson(), "assigned_role_area_type": assignedRoleAreaType?.toJson(), "assigned_area": assignedArea, }; } class AssignedRole { final int id; final RBAC? role; final CreatedBy? user; final DateTime? createdAt; final DateTime? updatedAt; final CreatedBy? createdBy; final CreatedBy? updatedBy; AssignedRole({ required this.id, required this.role, required this.user, required this.createdAt, required this.updatedAt, required this.createdBy, required this.updatedBy, }); factory AssignedRole.fromJson(Map json) => AssignedRole( id: json["id"], role: RBAC.fromJson(json["role"]), user: CreatedBy.fromJson(json["user"]), createdAt: DateTime.parse(json["created_at"]), updatedAt: DateTime.parse(json["updated_at"]), createdBy: CreatedBy.fromJson(json["created_by"]), updatedBy: CreatedBy.fromJson(json["updated_by"]), ); Map toJson() => { "id": id, "role": role?.toJson(), "user": user?.toJson(), "created_at": createdAt?.toIso8601String(), "updated_at": updatedAt?.toIso8601String(), "created_by": createdBy?.toJson(), "updated_by": updatedBy?.toJson(), }; }