Files
components/LiteCharms.Features/Leads/Commands/CreateLeadCommand.cs
T
2026-05-03 16:10:27 +02:00

50 lines
1.9 KiB
C#

namespace LiteCharms.Features.Leads.Commands;
public class CreateLeadCommand : IRequest<Result<Guid>>
{
public Guid? CustomerId { get; set; }
public string? GoogleClickId { get; set; }
public string? WebClickId { get; set; }
public string? AppClickId { get; set; }
public long? CampaignId { get; set; }
public long? AdGroupId { get; set; }
public long? AdName { get; set; }
public long? TargetId { get; set; }
public long? FeedItemId { get; set; }
public string? ClickLocation { get; set; }
public string? AttribusionHash { get; set; }
private CreateLeadCommand(Guid? customerId, string googleClickId, string webClickId, string appClickId, long? campaignId, long? adGroupId, long? adName, long? targetId, long? feedItemId, string? clickLocation, string? attribusionHash)
{
CustomerId = customerId;
GoogleClickId = googleClickId;
WebClickId = webClickId;
AppClickId = appClickId;
CampaignId = campaignId;
AdGroupId = adGroupId;
AdName = adName;
TargetId = targetId;
FeedItemId = feedItemId;
ClickLocation = clickLocation;
AttribusionHash = attribusionHash;
}
public static CreateLeadCommand Create(Guid? customerId, string googleClickId, string webClickId, string appClickId, long? campaignId, long? adGroupId, long? adName, long? targetId, long? feedItemId, string? clickLocation, string? attribusionHash)
{
if (string.IsNullOrWhiteSpace(googleClickId) || string.IsNullOrWhiteSpace(appClickId) || string.IsNullOrWhiteSpace(webClickId))
throw new ArgumentException("Google ClickId, App ClickId and Web ClickId are required to create a lead.");
return new(customerId, googleClickId, webClickId, appClickId, campaignId, adGroupId, adName, targetId, feedItemId, clickLocation, attribusionHash);
}
}