56 lines
2.1 KiB
C#
56 lines
2.1 KiB
C#
namespace LiteCharms.Features.Leads.Commands;
|
|
|
|
public class CreateLeadCommand : IRequest<Result<Guid>>
|
|
{
|
|
public Guid? CustomerId { get; set; }
|
|
|
|
public string? Source { get; set; }
|
|
|
|
public string? ClickId { 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 source, string clickId, string webClickId, string appClickId, long? campaignId, long? adGroupId, long? adName, long? targetId, long? feedItemId, string? clickLocation, string? attribusionHash)
|
|
{
|
|
CustomerId = customerId;
|
|
Source = source;
|
|
ClickId = clickId;
|
|
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 source, string clickId, string webClickId, string appClickId, long? campaignId, long? adGroupId, long? adName, long? targetId, long? feedItemId, string? clickLocation, string? attribusionHash)
|
|
{
|
|
if(string.IsNullOrWhiteSpace(source))
|
|
throw new ArgumentNullException("Lead source is required to create a lead.", nameof(source));
|
|
|
|
if (string.IsNullOrWhiteSpace(clickId) || string.IsNullOrWhiteSpace(appClickId) || string.IsNullOrWhiteSpace(webClickId))
|
|
throw new ArgumentException("ClickId, App ClickId and Web ClickId are required to create a lead.");
|
|
|
|
return new(customerId, source, clickId, webClickId, appClickId, campaignId, adGroupId, adName, targetId, feedItemId, clickLocation, attribusionHash);
|
|
}
|
|
}
|