package com.eshore.gringotts.web.domain.base.service;

import com.eshore.gringotts.web.domain.base.controller.query.Query;
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
import java.util.Optional;
import org.eclipse.collections.api.list.ImmutableList;
import org.eclipse.collections.api.set.ImmutableSet;

/**
 * @author lanyuanxiaoyao
 * @date 2024-11-28
 */
public interface SimpleService<ENTITY extends SimpleEntity> {
    Long save(ENTITY entity) throws Exception;

    ImmutableList<ENTITY> list() throws Exception;

    ImmutableList<ENTITY> list(ImmutableSet<Long> ids) throws Exception;

    ImmutableList<ENTITY> list(Query query) throws Exception;

    Optional<ENTITY> detailOptional(Long id) throws Exception;

    ENTITY detail(Long id) throws Exception;

    ENTITY detailOrThrow(Long id) throws Exception;

    ENTITY detailOrNull(Long id) throws Exception;

    void remove(Long id) throws Exception;
}
