// <auto-generated/>
// ReSharper disable All

namespace MyTelegram.Schema;

///<summary>
/// Shipping address
/// See <a href="https://corefork.telegram.org/constructor/postAddress" />
///</summary>
[TlObject(0x1e8caaeb)]
public sealed class TPostAddress : IPostAddress
{
    public uint ConstructorId => 0x1e8caaeb;
    ///<summary>
    /// First line for the address
    ///</summary>
    public string StreetLine1 { get; set; }

    ///<summary>
    /// Second line for the address
    ///</summary>
    public string StreetLine2 { get; set; }

    ///<summary>
    /// City
    ///</summary>
    public string City { get; set; }

    ///<summary>
    /// State, if applicable (empty otherwise)
    ///</summary>
    public string State { get; set; }

    ///<summary>
    /// ISO 3166-1 alpha-2 country code
    ///</summary>
    public string CountryIso2 { get; set; }

    ///<summary>
    /// Address post code
    ///</summary>
    public string PostCode { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(StreetLine1);
        writer.Write(StreetLine2);
        writer.Write(City);
        writer.Write(State);
        writer.Write(CountryIso2);
        writer.Write(PostCode);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        StreetLine1 = buffer.ReadString();
        StreetLine2 = buffer.ReadString();
        City = buffer.ReadString();
        State = buffer.ReadString();
        CountryIso2 = buffer.ReadString();
        PostCode = buffer.ReadString();
    }
}