using Posechaemost.Data.LocalData.Entity;
using Posechaemost.Data.RemoteData.RemoteDataBase.DAO;
using Posechaemost.Data.Repository;
using Posechaemost.Domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Posechaemost.Domain.UseCase
{
    public class GroupUseCase
    {
        private IGroupRepository _repositoryGroupImpl;

        public GroupUseCase(IGroupRepository repositoryGroupImpl)
        {
            _repositoryGroupImpl = repositoryGroupImpl;
        }

        public List<GroupDao> GetAllGroups() => _repositoryGroupImpl.GetAllGroup()
            .Select(it => new GroupDao { Id  = it.Id, Name = it.Name}).ToList();        

        public bool UpdateGroupName(String id, String name1) {
            return _repositoryGroupImpl.UpdateGroupById(int.Parse(id), name1);
        }
        public bool AddGroup(String name, String id) 
        {
            return _repositoryGroupImpl.AddGroup(new GroupDao { Name = name, Id = int.Parse(id) });
        }
    }
}