import 'package:pshared/data/dto/account/base.dart';
import 'package:pshared/models/account/base.dart';
import 'package:pshared/models/describable.dart';
import 'package:pshared/models/storable.dart';


extension AccountBaseMapper on AccountBase {
  AccountBaseDTO toDTO() => AccountBaseDTO(
    id: storable.id,
    createdAt: storable.createdAt,
    updatedAt: storable.updatedAt,
    name: describable.name,
    description: describable.description,
    lastName: lastName,
    avatarUrl: avatarUrl,
  );
}

extension AccountDTOMapper on AccountBaseDTO {
  AccountBase toDomain() => AccountBase(
    storable: newStorable(id: id, createdAt: createdAt, updatedAt: updatedAt),
    describable: newDescribable(name: name, description: description),
    lastName: lastName,
    avatarUrl: avatarUrl,
  );
}
