package org.initialde.yakasave.Application;

import org.initialde.yakasave.Domain.Entities.SavingsFund;
import org.initialde.yakasave.Infrastructure.Persistence.SavingsFundRepository;
import org.initialde.yakasave.Infrastructure.authentication.AuthenticationGateway;
import org.springframework.stereotype.Service;

@Service
public class CloseSavingsFund {
    private final SavingsFundRepository savingsFundRepository;
    private final AuthenticationGateway authenticationGateway;

    public CloseSavingsFund(SavingsFundRepository savingsFundRepository, AuthenticationGateway authenticationGateway) {
        this.savingsFundRepository = savingsFundRepository;
        this.authenticationGateway = authenticationGateway;
    }

    public void close(SavingsFund savingsFund) {
        savingsFund.close();
        savingsFundRepository.save(savingsFund);
    }
}
