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


extension PermissionsDescriptionMapper on PermissionsDescription {
  PermissionsDescriptionDTO toDTO() {
    return PermissionsDescriptionDTO(
      roles: roles.map((role) => role.toDTO()).toList(),
      policies: policies.map((policy) => policy.toDTO()).toList(),
    );
  }
}

extension PermissionsDescriptionDTOMapper on PermissionsDescriptionDTO {
  PermissionsDescription toDomain() {
    return PermissionsDescription(
      roles: roles.map((role) => role.toDomain()).toList(),
      policies: policies.map((policy) => policy.toDomain()).toList(),
    );
  }
}