@model System.Collections.Generic.KeyValuePair<string, string>
@using Disco.Models.Services.Users.Contact
@{
    UserContactEmail email;
    if (UserContactEmail.TryParse(null, null, Model.Value, out email))
    {
        <a href="mailto:@email.EmailAddress" data-clipboard="@email.ToString()">@(string.IsNullOrWhiteSpace(email.Name) ? email.EmailAddress : email.Name)</a>
    }
    else
    {
        UserContactAustralianPhone phone;
        if (UserContactAustralianPhone.TryParse(null, null, Model.Value, out phone))
        {
            <a href="tel:@phone.PhoneNumber" data-clipboard="@phone.ToString()">@(string.IsNullOrWhiteSpace(phone.Name) ? phone.PhoneNumber : phone.Name)</a>
        }
        else
        {
            UserContactAustralianPhone mobile;
            if (UserContactAustralianPhone.TryParse(null, null, Model.Value, out mobile))
            {
                <a href="tel:@mobile.PhoneNumber" data-clipboard="@mobile.ToString()">@(string.IsNullOrWhiteSpace(mobile.Name) ? mobile.PhoneNumber : mobile.Name)</a>
            }
            else
            {
                <span data-clipboard>@Model.Value</span>
            }
        }
    }
}
