Skip to content

Instantly share code, notes, and snippets.

@Banane9
Created July 27, 2018 10:42
Show Gist options
  • Save Banane9/29466d28d933a8f785af232293fe5432 to your computer and use it in GitHub Desktop.
Save Banane9/29466d28d933a8f785af232293fe5432 to your computer and use it in GitHub Desktop.
Idea for how to implement the restraints of the Telegram Passport elements
public abstract class PassportElement
{
public abstract string Name { get; }
}
public interface ICompatibility<TWith>
{ }
public sealed class PassportElementErrorDriverLicense : PassportElement, ICompatibility<PassportElementErrorDataField>
{
public override string Name => "driver_license";
}
public sealed class PassportElementErrorIdentityCard : PassportElement, ICompatibility<PassportElementErrorDataField>, ICompatibility<PassportElementErrorFrontSide>
{
public override string Name => "identity_card";
}
public sealed class PassportElementErrorFrontSide // : PassportError
{
public PassportElementErrorFrontSide(ICompatibility<PassportElementErrorFrontSide> errorType)
{ }
}
public sealed class PassportElementErrorDataField // : PassportError
{
public PassportElementErrorDataField(ICompatibility<PassportElementErrorDataField> errorType)
{ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment