36 lines
1.3 KiB
C#
36 lines
1.3 KiB
C#
using OwnChar.Model;
|
|
|
|
namespace OwnChar.Api;
|
|
|
|
public interface IDataProvider
|
|
{
|
|
bool IsInitialized();
|
|
void SetInitialized();
|
|
bool SaveDatabase();
|
|
|
|
// Model
|
|
abstract T? Create<T>() where T : OwnCharObject;
|
|
abstract bool Save<T>(T obj) where T : OwnCharObject;
|
|
abstract bool Delete<T>(T obj) where T : OwnCharObject;
|
|
|
|
// Hierarchy
|
|
abstract bool SetParent(UserProfile profile, UserAccount parent);
|
|
abstract bool SetParent(Character character, Group parent);
|
|
abstract bool SetParent(Property property, Character character);
|
|
abstract bool SetOwner(Group group, UserProfile owner);
|
|
abstract bool SetOwner(Character group, UserProfile owner);
|
|
|
|
// Gets
|
|
abstract UserAccount? GetUserAccount(string username, string password);
|
|
abstract UserProfile? GetUserProfile(string username);
|
|
abstract IEnumerable<UserProfile>? GetMembers(Group group);
|
|
abstract UserProfile? GetOwner(Group group);
|
|
abstract UserProfile? GetOwner(Character character);
|
|
abstract IEnumerable<Character>? GetCharacters(Group group);
|
|
abstract IEnumerable<Character>? GetCharacters(UserProfile jprofile);
|
|
|
|
// Sets
|
|
abstract bool AddMember(Group group, UserProfile user);
|
|
abstract bool RemoveMember(Group group, UserProfile user);
|
|
}
|