// <auto-generated/>

#nullable disable

using System;
using System.ClientModel.Primitives;
using System.Xml;
using Sample.Models;

namespace Sample
{
    public partial class MockInputModel
    {
        protected virtual void XmlModelWriteCore(global::System.Xml.XmlWriter writer, global::System.ClientModel.Primitives.ModelReaderWriterOptions options)
        {
            string format = (options.Format == "W") ? ((global::System.ClientModel.Primitives.IPersistableModel<global::Sample.Models.MockInputModel>)this).GetFormatFromOptions(options) : options.Format;
            if ((format != "X"))
            {
                throw new global::System.FormatException($"The model {nameof(global::Sample.Models.MockInputModel)} does not support writing '{format}' format.");
            }

            if (global::Sample.Optional.IsDefined(Id))
            {
                this.SerializeIdMethod(writer, options);
            }
            if (global::Sample.Optional.IsDefined(Name))
            {
                writer.WriteStartElement("name");
                writer.WriteValue(Name);
                writer.WriteEndElement();
            }
        }
    }
}
