using System;
using Azure.Communication;

namespace Azure.Communication.Chat
{
    /// <summary> A chat message read receipt indicates the time a chat message was read by a recipient. </summary>
    internal partial class ChatMessageReadReceiptInternal
    {
        /// <summary> Initializes a new instance of ChatMessageReadReceiptInternal. </summary>
        /// <param name="senderCommunicationIdentifier"> Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. </param>
        /// <param name="chatMessageId"> Id of the chat message that has been read. This id is generated by the server. </param>
        /// <param name="readOn"> The time at which the message was read. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="senderCommunicationIdentifier"/> or <paramref name="chatMessageId"/> is null. </exception>
        internal ChatMessageReadReceiptInternal(CommunicationIdentifierModel senderCommunicationIdentifier, string chatMessageId, DateTimeOffset readOn)
        {
            if (senderCommunicationIdentifier == null)
            {
                throw new ArgumentNullException(nameof(senderCommunicationIdentifier));
            }
            if (chatMessageId == null)
            {
                throw new ArgumentNullException(nameof(chatMessageId));
            }

            SenderCommunicationIdentifier = senderCommunicationIdentifier;
            ChatMessageId = chatMessageId;
            ReadOn = readOn;
        }

        /// <summary> Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. </summary>
        public CommunicationIdentifierModel SenderCommunicationIdentifier { get; }
        /// <summary> Id of the chat message that has been read. This id is generated by the server. </summary>
        public string ChatMessageId { get; }
        /// <summary> The time at which the message was read. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. </summary>
        public DateTimeOffset ReadOn { get; }
    }
}
