package com.codenetworkz.blog.services;


import com.codenetworkz.blog.dtos.CategoryDto;
import com.codenetworkz.blog.dtos.PostDto;
import com.codenetworkz.blog.dtos.PostTagAndCategoryDto;
import com.codenetworkz.blog.dtos.TagDto;
import com.codenetworkz.blog.exceptions.InternalServerException;
import com.codenetworkz.blog.exceptions.ResourceNotAvailable;

import com.codenetworkz.blog.models.Post;
import com.codenetworkz.blog.models.Status;
import org.apache.tomcat.util.http.fileupload.FileUploadException;
import org.springframework.data.domain.Page;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Optional;

public interface PostService {

    Optional<PostTagAndCategoryDto> getPostRequestData() throws InternalServerException;
    Optional<PostDto> save(String name, String content, List<Long> tagIds, List<Long> categoryIds, MultipartFile file, String isPublish, String author) throws InternalServerException, FileUploadException, ResourceNotAvailable;
    Optional<PostDto> delete(String postSlug) throws InternalServerException, ResourceNotAvailable;
    Optional<PostDto> update(String postSlug, String name, String content, List<Long> tagIds, List<Long> categoryIds, MultipartFile file, String isPublish, String author) throws InternalServerException, FileUploadException, ResourceNotAvailable;
    List<PostDto> findAll() throws InternalServerException, ResourceNotAvailable;
    Optional<Post>  findByPostSlug(String postSlug) throws InternalServerException, ResourceNotAvailable;
    Optional<PostDto>  changeStatusPublish(String postSlug) throws InternalServerException, ResourceNotAvailable;
    Optional<PostDto> changeActivateStatus(String postSlug) throws InternalServerException, ResourceNotAvailable;
    Optional<PostDto>  uploadFeaturedImage (String postSlug,MultipartFile file) throws InternalServerException, ResourceNotAvailable, FileUploadException;
    MultipartFile downloadFeaturedImage (String postSlug,String fileCode) throws InternalServerException, ResourceNotAvailable,FileUploadException;
    Optional<PostDto>  deleteFeaturedImage (String postSlug,String fileCode) throws InternalServerException, ResourceNotAvailable,FileUploadException;

    Page<PostDto> getPostWithPagination(Integer page, Integer size) throws InternalServerException;

}
