package com.loan.system.service.Impl;

import com.loan.system.domain.entity.*;
import com.loan.system.repository.DictAttributeRepository;
import com.loan.system.repository.DictChannelRepository;
import com.loan.system.repository.DictLocationRepository;
import com.loan.system.repository.DictTypeRepository;
import com.loan.system.service.DictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictionaryServiceImpl implements DictionaryService {
    private final DictAttributeRepository dictAttributeRepository;
    private final DictTypeRepository dictTypeRepository;
    private final DictChannelRepository dictChannelRepository;
    private final DictLocationRepository dictLocationRepository;


    @Autowired
    public DictionaryServiceImpl(DictAttributeRepository dictAttributeRepository, DictTypeRepository dictTypeRepository,
                                 DictChannelRepository dictChannelRepository, DictLocationRepository dictLocationRepository) {
        this.dictAttributeRepository= dictAttributeRepository;
        this.dictTypeRepository = dictTypeRepository;
        this.dictChannelRepository = dictChannelRepository;
        this.dictLocationRepository = dictLocationRepository;
    }

    @Override
    public List<DictAttribute> getAllDictAttributes(Boolean isDelete) {
        return dictAttributeRepository.findByIsDelete(isDelete);
    }

    @Override
    public List<DictBusinessType> getAllDictTypes(Boolean isDelete) {
        return dictTypeRepository.findByIsDelete(isDelete);
    }

    @Override
    public List<DictChannel> getAllDictChannels(Boolean isDelete) {
        return dictChannelRepository.findByIsDelete(isDelete);
    }

    @Override
    public List<DictLocation> getAllLocations(Boolean isDelete) {
        return dictLocationRepository.findByIsDelete(isDelete);
    }
}
