using System.Threading.Tasks;
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
using LCU.Library.Internal.CoreApiWrapperLib.Utilities;
using LCU.Library.Internal.CoreApiWrapperLib.Configuration;
using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities;
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties;
namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess
{
public class PropertyDao : BaseCoreDao, IPropertyDao
{
private readonly CoreConfiguration _coreConfiguration;
private readonly CoreApiConfiguration _coreApiConfiguration;
public PropertyDao(ICoreRequest coreRequest,
CoreConfiguration coreConfiguration)
: base(coreRequest)
{
_coreConfiguration = coreConfiguration;
_coreApiConfiguration = _coreConfiguration.CoreApiConfiguration;
}
///
/// Calls Core API to get all property by propertynumber.
/// Default Included: Graph, Standard
///
/// Property
public async Task FindProperty(long propertynumber)
{
var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.PropertyById,
RequestRootParameters.PropertyNumber,
propertynumber.ToString());
var result = await _coreRequest.GetRequestObject>(endpoint, null);
return result?.MessageBody;
}
}
}