package com.ningdatech.carapi.datascope.provider.impl;

import com.ningdatech.carapi.common.constant.CommonConstant;
import com.ningdatech.carapi.datascope.model.DataScopeDto;
import com.ningdatech.carapi.datascope.contants.DataScopeEnum;
import com.ningdatech.carapi.datascope.provider.DataScopeProvider;
import com.ningdatech.carapi.sys.contants.RegionContant;
import com.ningdatech.carapi.sys.helper.RegionsCacheHelper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Optional;


/**
 * <p>
 * 数据权限{@link DataScopeEnum#ALL}
 * </p>
 *
 * @author WendyYang
 * @since 2022/1/9 23:29
 */
@Slf4j
@RequiredArgsConstructor
@Component("DATA_SCOPE_1")
public class AllDataScopeProviderImpl implements DataScopeProvider {

    private final RegionsCacheHelper regionsCacheHelper;
    @Override
    public Optional<DataScopeDto> findDataFieldProperty() {
        DataScopeDto dataScopeDto = new DataScopeDto();
        //全部权限的话 最大是浙江
        dataScopeDto.setMaxRegion(regionsCacheHelper.getByRegionId(RegionContant.ZJ_REGION_ID));
        return Optional.ofNullable(dataScopeDto);
    }

}
