/*
 *  Copyright 2019-2020  Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.youchain.basicdata.service;

import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.service.dto.PointDto;
import com.youchain.basicdata.service.dto.PointQueryCriteria;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;
import java.util.List;
import java.io.IOException;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;

/**
 * @author liuxue
 * @website https://elAdmin.vip
 * @description 服务接口
 * @date 2023-07-26
 **/
public interface PointService {

    /**
     * 查询数据分页
     *
     * @param criteria 条件
     * @param pageable 分页参数
     * @return Map<String, Object>
     */
    Map<String, Object> queryAll(PointQueryCriteria criteria, Pageable pageable);

    /**
     * 查询所有数据不分页
     *
     * @param criteria 条件参数
     * @return List<PointDto>
     */
    List<PointDto> queryAll(PointQueryCriteria criteria);


    /**
     * 根据ID查询
     *
     * @param id ID
     * @return PointDto
     */
    PointDto findById(Long id);

    /**
     * 创建
     *
     * @param resources /
     * @return PointDto
     */
    PointDto create(Point resources);

    /**
     * 编辑
     *
     * @param resources /
     */
    void update(Point resources);

    /**
     * 多选删除
     *
     * @param ids /
     */
    void deleteAll(Long[] ids);

    /**
     * 导出数据
     *
     * @param all      待导出的数据
     * @param response /
     * @throws IOException /
     */
    void download(List<PointDto> all, HttpServletResponse response) throws IOException;

    /**
     * 验证点位是否存在
     *
     * @param position 点位
     */
    Point validatePoint(String position);

    /**
     * 占用点位
     * @param point 点位
     */
    void usedPoint(Point point);

    /**
     * 释放点位
     * @param point 点位
     */
    void freePoint(Point point);

    /**
     * 验证点位状态
     * @param point 点位
     */
    void validatePointStatus(Point point);

    /**
     * 查询点位
     * @param code 点位编码
     * @param status 状态
     * @param type 类型
     * @param areaName 库区
     */
    List<Point> queryPoints(String code, String status, String type, String areaName);

    /**
     * 查询点位
     * @param areaNames 库区
     * @param status 状态
     */
    List<Point> queryByAreaNames(List<String>  areaNames,String status);


    /**
     * 查询点位
     * @param code 点位编码
     * @param status 状态
     * @param type 类型
     * @param areaName 库区
     */
    Point queryPoint(String code, String status, String type, String areaName);

    /**
     * 批量查询点位
     * @param pointCodes 点位集合
     */
    Map<String, Point> findByCodes(Set<String> pointCodes);

    /**
     * 导入点位
     * @param multipartFile 文件
     */
    String importPoint(MultipartFile multipartFile);
}
