using System;
using System.Collections.Generic;
using System.ServiceModel;
using BeWo.Data.Entities;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared;

namespace BeWo.Service.ServiceContracts
{
    [ServiceContract]
    public interface IUserService
    {
        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        long ChangePassword(string pUserName, long pUserVersion, string pOldPassword, string pNewPassword);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        void CreateNewUser(string pUserName, string pPassword, string pEmail);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        void DeactivateUser(long pOid, long pVersion);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        void DeactivateUserGroup(long pOid, long pVersion);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        void DeactivateUsers(Dictionary<long, long> pOid2Version);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        void DeleteUser(long pOid, long pVersion);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        void DeleteUserGroup(long pOid, long pVersion);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        void DeleteUserGroups(Dictionary<long, long> pOid2Version);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        void DeleteUsers(Dictionary<long, long> pOid2Version);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        List<CompactUserDC> FindUser(string pLoginName, string pEmployeeFirstName, string pEmployeeLastName);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        List<UserGroupDC> GetAllUserGroups();

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        List<CompactUserDC> GetAllUsersCompact();

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        List<UserGroupDC> GetLastOpenedUserGroups();

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        List<CompactUserDC> GetLastOpenedUsers();

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        long InsertNewUser(UserDC pUser);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        long InsertNewUserGroup(UserGroupDC pUserGroup);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        UserValidationResult IsUserValid(string pUserName, string pPassword, string pPIN);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        UserDC LoadUser(long pUserOid);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        UserDC LoadUserByLoginName(string pUserName);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        UserGroupDC LoadUserGroup(long pOid);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        long UpdateUser(UserDC pUser);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        long UpdateUserGroup(UserGroupDC pUserGroup);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        List<SettingsDC> UpdateUserSettings(long userOid, List<SettingsDC> settings);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        long InsertNewSupportPin(SupportPinDC pSupportPin);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        List<SupportPinDC> GetAllSupportPins();

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        long UpdateSupportPin(SupportPinDC pSupportPin);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        SupportPinDC GetSupportPinByPIN(string pin);

		[FaultContract(typeof(BeWoFault))]
		[OperationContract]
		bool GetEmailForUserName(string pUserName, Uri serverName, out string email);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        String CheckPassword(long userOid, string oldPassword, string newPassword);

        [FaultContract(typeof(BeWoFault))]
        [OperationContract]
        bool CheckUserGroupIsLastWithUserGroupEditRights(long pUserGroupOid);
    }
}