using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainBusiness.Interfaces;
using skydiveLogs_api.DomainService.Repositories;
using System;
using System.Collections.Generic;

namespace skydiveLogs_api.DomainBusiness
{
    public class UserImageService : IUserImageService
    {
        #region Public Constructors

        public UserImageService(IUserImageRepository imageRepository,
                                IIdentityService identityService)
        {
            _imageRepository = imageRepository;
            _identityService = identityService;
        }

        #endregion Public Constructors

        #region Public Methods

        public void AddNewImage(UserImage newImage)
        {
            newImage.User = _identityService.ConnectedUser;
            _imageRepository.Add(newImage);
        }

        public void DeleteImageById(int id)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<UserImage> GetAllImages()
        {
            return _imageRepository.GetAll(_identityService.ConnectedUser);
        }

        public UserImage GetImageById(int id)
        {
            return _imageRepository.GetById(id);
        }

        public void UpdateImage(int id, UserImage Image)
        {
            throw new NotImplementedException();
        }

        #endregion Public Methods

        #region Private Fields

        private readonly IIdentityService _identityService;
        private readonly IUserImageRepository _imageRepository;

        #endregion Private Fields
    }
}