package com.upsfj.sfjprojectbackend.service.impl;

import com.upsfj.sfjprojectbackend.entity.UseCase;
import com.upsfj.sfjprojectbackend.mapper.UseMapper;
import com.upsfj.sfjprojectbackend.mapper.UserMapper;
import com.upsfj.sfjprojectbackend.service.UsecaseService;
import jakarta.annotation.Resource;
import jakarta.transaction.Transactional;
import org.springframework.stereotype.Service;

@Service
public class UsecaseServiceImpl implements UsecaseService {
    @Resource
    UseMapper useMapper;

    @Override
    public void addUsecase(String usecaseName) {
        useMapper.AddUsecase(usecaseName);
    }

    @Override
    public void updateUsecase(UseCase usecase) {
        useMapper.UpdateUsecase(usecase);
    }

    @Override
    @Transactional
    public void deleteUsecase(UseCase usecase) {
        useMapper.DeleteAlgorithmForUse(usecase);
        useMapper.DeleteUsecase(usecase);
    }
}
