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


extension AccountMapper on Account {
  AccountDTO toDTO() => AccountDTO(
    id: id,
    createdAt: createdAt,
    updatedAt: updatedAt,
    name: name,
    lastName: lastName,
    description: description,
    avatarUrl: avatarUrl,
    locale: locale,
    login: login,
  );
}

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