using Indotalent.Data.Entities;
using Indotalent.Shared.Consts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;

public class TenantConfiguration : IEntityTypeConfiguration<Tenant>
{
    public void Configure(EntityTypeBuilder<Tenant> builder)
    {
        builder.Property(e => e.Name)
            .HasMaxLength(GlobalConsts.StringLengthShort);

        builder.Property(e => e.Description)
            .HasMaxLength(GlobalConsts.StringLengthMedium);

        builder.Property(e => e.Street)
            .HasMaxLength(GlobalConsts.StringLengthShort);

        builder.Property(e => e.City)
            .HasMaxLength(GlobalConsts.StringLengthShort);

        builder.Property(e => e.State)
            .HasMaxLength(GlobalConsts.StringLengthShort);

        builder.Property(e => e.ZipCode)
            .HasMaxLength(GlobalConsts.StringLengthShort);

        builder.Property(e => e.Country)
            .HasMaxLength(GlobalConsts.StringLengthShort);

        builder.Property(e => e.PhoneNumber)
            .HasMaxLength(GlobalConsts.StringLengthShort);

        builder.Property(e => e.FaxNumber)
            .HasMaxLength(GlobalConsts.StringLengthShort);

        builder.Property(e => e.EmailAddress)
            .HasMaxLength(GlobalConsts.StringLengthShort);

        builder.Property(e => e.Website)
            .HasMaxLength(GlobalConsts.StringLengthShort);

        builder.HasIndex(e => e.Name);
    }
}