using FlatRender.IdentitySvc.Domain.Entities;
using FlatRender.IdentitySvc.Models.Requests;
using FlatRender.IdentitySvc.Models.Responses;

namespace FlatRender.IdentitySvc.Application.Services.Interfaces;

public interface ITenantService
{
    Task<PagedResponse<TenantResponse>> ListAsync(int page, int pageSize);
    Task<TenantResponse> CreateAsync(CreateTenantRequest request);
    Task<TenantResponse> GetByIdAsync(Guid tenantId);
    Task<TenantResponse> GetBySlugAsync(string slug);
    Task<TenantResponse> UpdateAsync(Guid tenantId, UpdateTenantRequest request);
    Task<TenantBrandingResponse> GetBrandingAsync(Guid tenantId);
    Task<TenantBrandingResponse> UpsertBrandingAsync(Guid tenantId, TenantBrandingRequest request);
    Task<DomainVerificationResponse> StartDomainVerificationAsync(Guid tenantId, string domain, string method);
    Task<List<TenantUsageDayResponse>> GetUsageAsync(Guid tenantId, DateOnly from, DateOnly to);

    // API Keys
    Task<List<ApiKeyResponse>> GetApiKeysAsync(Guid tenantId);
    Task<ApiKeyCreatedResponse> CreateApiKeyAsync(Guid tenantId, Guid createdByUserId, CreateApiKeyRequest request);
    Task RevokeApiKeyAsync(Guid tenantId, Guid apiKeyId, string? reason);
    Task<ApiKeyValidateResponse> ValidateApiKeyAsync(string keyPrefix, string keyHash, string? ipAddress);

    // Webhooks
    Task<List<WebhookResponse>> GetWebhooksAsync(Guid tenantId);
    Task<WebhookResponse> CreateWebhookAsync(Guid tenantId, CreateWebhookRequest request);
    Task DeleteWebhookAsync(Guid tenantId, Guid webhookId);
    Task<List<WebhookDeliveryResponse>> GetWebhookDeliveriesAsync(Guid tenantId, Guid webhookId);
}
