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


extension RoleDescriptionMapper on RoleDescription {
  RoleDescriptionDTO toDTO() => RoleDescriptionDTO(
    id: storable.id,
    createdAt: storable.createdAt,
    updatedAt: storable.updatedAt,
    name: describable.name,
    description: describable.description,
    organizationRef: organizationRef,
  );
}

extension RoleDescriptionDTOMapper on RoleDescriptionDTO {
  RoleDescription toDomain() => RoleDescription(
    storable: newStorable(id: id, createdAt: createdAt, updatedAt: updatedAt),
    describable: newDescribable(name: name, description: description),
    organizationRef: organizationRef,
  );
}
