﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using Platnosci.Core.Linq;

namespace Platnosci.Core.Interface
{
    public interface IRepository<T> where T : IIdentifiable
    {
        int Count();

        int Count(Expression<Func<T, bool>> expression);

        void Insert(T entity);

        void Delete(T entity);
        
        void SubmitChanges();

        T FindOne(int id);

        T FindOne(Expression<Func<T, bool>> expression);

        bool TryFindOne(Expression<Func<T, bool>> expression, out T entity);

        bool Exists(Expression<Func<T, bool>> expression);

        IList<T> FindAll();

        IList<T> FindAll(Expression<Func<T, bool>> expression);

        IQueryable<T> Find();

        IQueryable<T> Find(int id);

        IQueryable<T> Find(Expression<Func<T, bool>> expression);

        IQueryable<vPlatnosciEcard> FindInvoiceByNipNumber(string nip, string numer);

        List<PotwierdzeniaEcard> FindItemsByIdFaktury(int idFaktury);
    }
}