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


extension PolicyMapper on Policy {
  PolicyDTO toDTO() {
    return PolicyDTO(
      roleDescriptionRef: roleDescriptionRef,
      organizationRef: organizationRef,
      descriptionRef: descriptionRef,
      objectRef: objectRef,
      effect: effect.toDTO(),
    );
  }
}

extension PolicyDTOMapper on PolicyDTO {
  Policy toDomain() {
    return Policy(
      roleDescriptionRef: roleDescriptionRef,
      organizationRef: organizationRef,
      descriptionRef: descriptionRef,
      objectRef: objectRef,
      effect: effect.toDomain(),
    );
  }
}
