import 'package:pshared/data/dto/permissions/data/permissions.dart';
import 'package:pshared/data/mapper/permissions/data/permission.dart';
import 'package:pshared/data/mapper/permissions/data/policy.dart';
import 'package:pshared/data/mapper/permissions/data/role.dart';
import 'package:pshared/models/permissions/data/permissions.dart';


extension PermissionsDataMapper on PermissionsData {
  PermissionsDataDTO toDTO() {
    return PermissionsDataDTO(
      roles: roles.map((role) => role.toDTO()).toList(),
      policies: policies.map((policy) => policy.toDTO()).toList(),
      permissions: permissions.map((permission) => permission.toDTO()).toList(),
    );
  }
}

extension PermissionsDataDTOMapper on PermissionsDataDTO {
  PermissionsData toDomain() {
    return PermissionsData(
      roles: roles.map((role) => role.toDomain()).toList(),
      policies: policies.map((policy) => policy.toDomain()).toList(),
      permissions: permissions.map((permission) => permission.toDomain()).toList(),
    );
  }
}