Main.java
package org.example;

import org.example.model.Account;
import org.example.model.Transaction;
import org.example.model.User;

import static org.example.service.ClientService.*;

public class Main {
    public static void main(String[] args) {
        User user = registerNewUser("125", "1t6115ajmskfj");
        Account account = createNewAccount(user, Account.TypeAccount.SAVINGS);
        System.out.println(user);

        createNewTransaction(account, Transaction.TypeTransaction.DEPOSIT, 1000);
        createNewTransaction(account, Transaction.TypeTransaction.WITHDRAW, 1000);
        System.out.println(user.getAllMoney());
    }
}





Account.java
package org.example.model;

import lombok.*;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@RequiredArgsConstructor
@ToString
@EqualsAndHashCode
@Getter
public class Account {
    private final UUID uuid = UUID.randomUUID();
    private double balance;

    @NonNull
    private TypeAccount type;
    //    private double dept;
    private final List<Transaction> transactions = new ArrayList<Transaction>();

    public void addTransaction(Transaction transaction) {
        transactions.add(transaction);
        balance += transaction.getMoney();
    }

    public enum TypeAccount {
        SAVINGS,
        CREDIT
    }
}


Transaction.java
package org.example.model;

import lombok.*;

import java.time.LocalDateTime;
import java.util.UUID;

@ToString
@EqualsAndHashCode
@Getter
public class Transaction {
    private final UUID uuid = UUID.randomUUID();
    private final LocalDateTime dateTime = LocalDateTime.now();
    @NonNull
    private TypeTransaction type;
    private Account accountSender;
    @NonNull
    private double money;

    public Transaction(TypeTransaction type, double money) {
        this.type = type;
        this.money = type.equals(TypeTransaction.WITHDRAW) ? Math.abs(money) * -1. : Math.abs(money);
    }

    public enum TypeTransaction {
        DEPOSIT,
        WITHDRAW
//        TRANSFER
    }
}


User.java
package org.example.model;

import lombok.Data;

import java.util.ArrayList;
import java.util.UUID;

@Data
public class User {
    private final UUID uuid = UUID.randomUUID();
    private String password;
    private String userName;

    private ArrayList<Account> accounts = new ArrayList<Account>();

    public void addAccount(Account account) {
        accounts.add(account);
    }

    public double getAllMoney() {
        double money = 0;
        for (Account account : accounts) {
            money += account.getBalance();
        }

        return money;
    }
}


ClientService.java
package org.example.service;

import org.example.model.Account;
import org.example.model.Account.TypeAccount;
import org.example.model.Transaction;
import org.example.model.User;

public class ClientService {

    public static User registerNewUser(String userName, String password) {
        User user = new User();
        user.setUserName(userName);
        user.setPassword(password);
        return user;
    }

    public static Account createNewAccount(User user, TypeAccount type) {
        Account account = new Account(type);
        user.addAccount(account);
        return account;
    }

    public static void createNewTransaction(Account account, Transaction.TypeTransaction type, double money) {
        Transaction transaction = new Transaction(type, money);
        account.addTransaction(transaction);
    }
}




ЧТО МНЕ ЕЩЕ ДОБАВИТЬ И ИЗМЕНИТЬ
Я ЕЩЕ ХОЧУ СДЕЛАТЬ CLI или UI