// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

// <auto-generated/>

#nullable disable

using System;
using System.Xml.Linq;
using Azure.Core;

namespace Azure.Storage.Queues.Models
{
    public partial class SendReceipt
    {
        internal static SendReceipt DeserializeSendReceipt(XElement element)
        {
            string messageId = default;
            DateTimeOffset insertionTime = default;
            DateTimeOffset expirationTime = default;
            string popReceipt = default;
            DateTimeOffset timeNextVisible = default;
            if (element.Element("MessageId") is XElement messageIdElement)
            {
                messageId = (string)messageIdElement;
            }
            if (element.Element("InsertionTime") is XElement insertionTimeElement)
            {
                insertionTime = insertionTimeElement.GetDateTimeOffsetValue("R");
            }
            if (element.Element("ExpirationTime") is XElement expirationTimeElement)
            {
                expirationTime = expirationTimeElement.GetDateTimeOffsetValue("R");
            }
            if (element.Element("PopReceipt") is XElement popReceiptElement)
            {
                popReceipt = (string)popReceiptElement;
            }
            if (element.Element("TimeNextVisible") is XElement timeNextVisibleElement)
            {
                timeNextVisible = timeNextVisibleElement.GetDateTimeOffsetValue("R");
            }
            return new SendReceipt(messageId, insertionTime, expirationTime, popReceipt, timeNextVisible);
        }
    }
}
