import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'update_user_request_model.freezed.dart';
part 'update_user_request_model.g.dart';

@freezed
abstract class UpdateUserRequestModel with _$UpdateUserRequestModel {
  const factory UpdateUserRequestModel({
    required String id,
    String? delegationId,
    String? email,
    String? createdAt,
    String? updatedAt,
    String? status,
    String? role,
    String? lastLogin,
    String? currentLogin,
    String? language,
    String? firstName,
    String? lastName,
    String? hasApiKey,
    String? phone,
  }) = _UpdateUserRequestModel;

  factory UpdateUserRequestModel.fromJson(Map<String, dynamic> json) =>
      _$UpdateUserRequestModelFromJson(json);
}

extension UpdateUserRequestModelMapper on UpdateUserRequestEntity {
  UpdateUserRequestModel toModel() => UpdateUserRequestModel(
    id: id,
    delegationId: delegationId,
    email: email,
    createdAt: createdAt,
    updatedAt: updatedAt,
    status: status,
    role: role,
    lastLogin: lastLogin,
    currentLogin: currentLogin,
    language: language,
    firstName: firstName,
    lastName: lastName,
    hasApiKey: hasApiKey,
    phone: phone,
  );
}
