Last active
June 23, 2023 18:26
-
-
Save maiconheck/865369bc5ec7faf1e611838c099db909 to your computer and use it in GitHub Desktop.
[4º Improvement]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Lead : Entity | |
{ | |
private readonly List<Segment> _segments; | |
public Lead(Name name, Email email) | |
{ | |
Guard.Against | |
.Null(name, nameof(name)) | |
.Null(email, nameof(email)); | |
_segments = new List<Segment>(); | |
Name = name; | |
Email = email; | |
} | |
public Name Name { get; } | |
public Email Email { get; } | |
public PhoneNumber? PhoneNumber { get; private set; } | |
public Address? Address { get; private set; } | |
public bool? Gender { get; private set; } | |
public DateTime? BirthDate { get; private set; } | |
public IReadOnlyList<Segment> Segments => _segments.ToList(); | |
public void AddSegment(Segment segment) | |
{ | |
Guard.Against.Null(segment, nameof(segment)); | |
_segments.Add(segment); | |
} | |
public void CompleteInfo(PhoneNumber phoneNumber, Address address, bool gender, DateTime birthDate) | |
{ | |
Guard.Against | |
.Null(phoneNumber, nameof(phoneNumber)) | |
.Null(address, nameof(address)); | |
PhoneNumber = phoneNumber; | |
Address = address; | |
Gender = gender; | |
BirthDate = birthDate; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment