using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;

namespace FMSAdmin.Entities {
    public partial class FmsMaterialCodeLocation {
        public FmsMaterialCodeLocation() {
            FmsMaterial = new HashSet<FmsMaterial>();
        }

        [Key]
        public int SiteId { get; set; }
        [Key]
        public int LocationId { get; set; }
        public int BusinessFieldId { get; set; }
        [Required]
        [StringLength(48)]
        public string Name { get; set; }
        public bool IsUse { get; set; }

        [ForeignKey("BusinessFieldId")]
        [InverseProperty("FmsMaterialCodeLocation")]
        public virtual CmBusinessField CmBusinessField { get; set; }
        [ForeignKey(nameof(SiteId))]
        [InverseProperty(nameof(CmSite.FmsMaterialCodeLocation))]
        public virtual CmSite Site { get; set; }

        [JsonIgnore]
        [InverseProperty("FmsMaterialCodeLocation")]
        public virtual ICollection<FmsMaterial> FmsMaterial { get; set; }
    }
}
