﻿using SGH_Khronos.Model;
using System.Data.Entity.ModelConfiguration;

namespace SGH_Khronos.Data.Mapping
{
    public class MedicoMap : EntityTypeConfiguration<Medico>
    {
        public MedicoMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Crm).IsRequired().HasMaxLength(10);
            this.Property(t => t.CrmUf).IsRequired();
            this.Property(t => t.Especialidade).HasMaxLength(30);

            // Table & Column Mappings
            this.ToTable("Medicos");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Crm).HasColumnName("Crm");
            this.Property(t => t.CrmUf).HasColumnName("CrmUf");
            this.Property(t => t.Especialidade).HasColumnName("Especialidade");
        }
    }
}
