using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;

namespace Elwig.Models.Entities {
    [Table("member_billing_address"), PrimaryKey("MgNr")]
    public class BillingAddr : IAddress {
        [Column("mgnr")]
        public int MgNr { get; set; }

        [Column("name")]
        public required string FullName { get; set; }

        [Column("country")]
        public int CountryNum { get; set; }

        [Column("postal_dest")]
        public required string PostalDestId { get; set; }

        [Column("address")]
        public required string Address { get; set; }

        [ForeignKey("MgNr")]
        public virtual Member Member { get; private set; } = null!;

        [ForeignKey("CountryNum")]
        public virtual Country Country { get; private set; } = null!;

        [ForeignKey("CountryNum, PostalDestId")]
        public virtual PostalDest PostalDest { get; private set; } = null!;
    }
}
