using System.ComponentModel.DataAnnotations;

namespace MemberCenter.Web.Models.Profile;

public sealed class AddressFormViewModel
{
    public Guid? Id { get; set; }

    [Display(Name = "Label")]
    [Required(ErrorMessage = "The {0} field is required.")]
    [StringLength(100, ErrorMessage = "The field {0} must be a string with a maximum length of {1}.")]
    public string Label { get; set; } = "home";

    [Display(Name = "Recipient name")]
    [Required(ErrorMessage = "The {0} field is required.")]
    [StringLength(100, ErrorMessage = "The field {0} must be a string with a maximum length of {1}.")]
    public string RecipientName { get; set; } = string.Empty;

    [Display(Name = "Recipient phone")]
    [Required(ErrorMessage = "The {0} field is required.")]
    [StringLength(50, ErrorMessage = "The field {0} must be a string with a maximum length of {1}.")]
    public string RecipientPhone { get; set; } = string.Empty;

    [Display(Name = "Country code")]
    [Required(ErrorMessage = "The {0} field is required.")]
    [StringLength(2, MinimumLength = 2, ErrorMessage = "The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.")]
    public string CountryCode { get; set; } = "TW";

    [Display(Name = "Postal code")]
    [StringLength(20, ErrorMessage = "The field {0} must be a string with a maximum length of {1}.")]
    public string? PostalCode { get; set; }

    [Display(Name = "State / region")]
    [StringLength(100, ErrorMessage = "The field {0} must be a string with a maximum length of {1}.")]
    public string? StateRegion { get; set; }

    [Display(Name = "City")]
    [StringLength(100, ErrorMessage = "The field {0} must be a string with a maximum length of {1}.")]
    public string? City { get; set; }

    [Display(Name = "District")]
    [StringLength(100, ErrorMessage = "The field {0} must be a string with a maximum length of {1}.")]
    public string? District { get; set; }

    [Display(Name = "Address line 1")]
    [Required(ErrorMessage = "The {0} field is required.")]
    [StringLength(255, ErrorMessage = "The field {0} must be a string with a maximum length of {1}.")]
    public string AddressLine1 { get; set; } = string.Empty;

    [Display(Name = "Address line 2")]
    [StringLength(255, ErrorMessage = "The field {0} must be a string with a maximum length of {1}.")]
    public string? AddressLine2 { get; set; }

    [Display(Name = "Company name")]
    [StringLength(200, ErrorMessage = "The field {0} must be a string with a maximum length of {1}.")]
    public string? CompanyName { get; set; }

    public bool IsDefault { get; set; }

    public string? AddressMetaJson { get; set; }
}
