| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | |
|
| | 4 | | namespace DCL.Social.Friends |
| | 5 | | { |
| | 6 | | public class FriendRequest |
| | 7 | | { |
| | 8 | | protected bool Equals(FriendRequest other) => |
| 8 | 9 | | FriendRequestId == other.FriendRequestId && Timestamp == other.Timestamp && From == other.From && To == othe |
| | 10 | |
|
| | 11 | | public override bool Equals(object obj) |
| | 12 | | { |
| 8 | 13 | | if (ReferenceEquals(null, obj)) return false; |
| 8 | 14 | | if (ReferenceEquals(this, obj)) return true; |
| 8 | 15 | | if (obj.GetType() != this.GetType()) return false; |
| 8 | 16 | | return Equals((FriendRequest)obj); |
| | 17 | | } |
| | 18 | |
|
| | 19 | | public override int GetHashCode() => |
| 0 | 20 | | HashCode.Combine(FriendRequestId, Timestamp, From, To, MessageBody); |
| | 21 | |
|
| 70 | 22 | | public string FriendRequestId { get; } |
| 72 | 23 | | public DateTime Timestamp { get; } |
| 90 | 24 | | public string From { get; } |
| 55 | 25 | | public string To { get; } |
| 29 | 26 | | public string MessageBody { get; } |
| 0 | 27 | | public bool HasBodyMessage => !string.IsNullOrEmpty(MessageBody); |
| | 28 | |
|
| 56 | 29 | | public FriendRequest(string friendRequestId, DateTime timestamp, string from, string to, string messageBody) |
| | 30 | | { |
| 56 | 31 | | FriendRequestId = friendRequestId; |
| 56 | 32 | | Timestamp = timestamp; |
| 56 | 33 | | From = from; |
| 56 | 34 | | To = to; |
| 56 | 35 | | MessageBody = messageBody; |
| 56 | 36 | | } |
| | 37 | |
|
| | 38 | | public bool IsSentTo(string userId) => |
| 0 | 39 | | To == userId; |
| | 40 | |
|
| | 41 | | public bool IsReceivedFrom(string userId) => |
| 0 | 42 | | From == userId; |
| | 43 | | } |
| | 44 | | } |