using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
{
///
/// "$.name":"明",
/// "!$.name":"小"
/// "code.|":{"aaa"}
/// "<.birthday":20150101,
/// "!=.type":"测试",
/// "<=.day":"1515"
/// ">.age.&":18,
/// "codes[*]":{"aaa"}
/// "codes[*]":["aaa","bbb"]
/// "code":["aaa","bbb"]
/// "@OFFSET":1,
/// "@LIMIT":10,
/// "@DESC","crateTime"
/// "@ASC","crateTime"
///
public interface IAzureCosmosDBV3Repository
{
Task Save(T entity) where T : ID;
Task> SaveAll(List enyites) where T : ID;
Task DeleteAsync(T entity) where T : ID;
Task DeleteAsync(string id, string pk) where T : ID;
Task DeleteAsync(IdPk idPk) where T : ID;
Task> DeleteAll(List entities) where T : ID;
Task> DeleteAll(List ids) where T : ID;
Task> DeleteAll(Dictionary dict) where T : ID;
Task Update(T entity) where T : ID;
Task> UpdateAll(List entities) where T : ID;
Task SaveOrUpdate(T entity) where T : ID;
Task> SaveOrUpdateAll(List entities) where T : ID;
// Task FindById(string id) where T : ID;
Task FindByIdPk(string id, string pk) where T : ID;
// Task ReplaceObject(T entity, string key, string partitionKey) where T : ID;
Task> FindAll(List propertys = null) where T : ID;
///
/// QueryText = @"SELECT *
// FROM c
// WHERE c.documentType = @documentType
// AND c.id = @id",
//Parameters = new[]
//{
// new CosmosDbQueryParameter("@documentType", GetDocumentType()),
// new CosmosDbQueryParameter("@id", id)
//}
///
///
///
///
///
Task> FindSQL(string sql, Dictionary Parameters = null, int itemsPerPage = -1, int? maxItemCount = null) where T : ID;
//Task> FindSQL(string sql, bool isPK) where T : ID;
///
/////正确的代码
//Expression> predicate = null;
// query = f => 1==1;
// query= query.And(x =>x.Address.City== "Seattle3");
// query= query.Or(x => x.id== "Andersen.1");
// query = query.And(x => x.Parents.Where(y => y.FirstName == "Thomas1").Any()) ;
// Expression> order = null;
//order = f => f.id;
//_questionFeedRepository.Entities.Where(predicate);
///
///
///
///
///
Task> FindLinq(Expression> query = null, Expression> order = null, bool isDesc = false, int itemsPerPage = -1, int? maxItemCount = null) where T : ID;
Task> FindByParams(Dictionary dict, int itemsPerPage = -1, int? maxItemCount = null, string partitionKey = null, List propertys = null) where T : ID;
Task> FindByDict(Dictionary dict, int itemsPerPage = -1, int? maxItemCount = null, string partitionKey = null, List propertys = null) where T : ID;
Task> FindByDict(string CollectionName, Dictionary dict, int itemsPerPage = -1, int? maxItemCount = null, string partitionKey = null, List propertys = null);
Task> FindCountByDict(string CollectionName, Dictionary dict, int itemsPerPage = -1, int? maxItemCount = null, string partitionKey = null);
Task InitializeDatabase();
TaskFindById(string id) where T : ID;
Task> FindByIds(List ids) where T : ID;
Task FindById(string CollectionName, string id);
Task> FindByIds (string CollectionName, List ids);
}
}