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


extension PolicyDescriptionMapper on PolicyDescription {
  PolicyDescriptionDTO toDTO() => PolicyDescriptionDTO(
    id: storable.id,
    createdAt: storable.createdAt,
    updatedAt: storable.updatedAt,
    name: describable.name,
    description: describable.description,
    resourceTypes: resourceTypes,
    organizationRef: organizationRef,
  );
}

extension PolicyDescriptionDTOMapper on PolicyDescriptionDTO {
  PolicyDescription toDomain() => PolicyDescription(
    storable: newStorable(id: id, createdAt: createdAt, updatedAt: createdAt),
    describable: newDescribable(name: name, description: description),
    resourceTypes: resourceTypes,
    organizationRef: organizationRef,
  );
}
