using FluentMigrator;
using FluentMigrator.Builders.Create.Table;
using Nop.Data.Mapping.Builders;
using Nop.Plugin.Misc.AuctionPlugin.Domains;
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;

namespace Nop.Plugin.Misc.AuctionPlugin.Mapping.Builders;

/// <summary>
/// Represents a pickup point entity builder
/// </summary>
public class AnnouncementBuilder : NopEntityBuilder<Announcement>
{
    #region Methods

    /// <summary>
    /// Apply entity configuration
    /// </summary>
    /// <param name="table">Create table expression builder</param>
    public override void MapEntity(CreateTableExpressionBuilder table)
    {
        table.WithColumn(nameof(Announcement.Name))
            .AsString(250)
                .NotNullable()
            .WithColumn(nameof(Announcement.IsActive))
                .AsBoolean()
                .NotNullable()
            .WithColumn(nameof(Announcement.Body))
                .AsString(500)
                .NotNullable()
            .WithColumn(nameof(Announcement.Created))
                .AsDateTime().NotNullable().WithDefault(SystemMethods.CurrentUTCDateTime);
              
    }

    #endregion
}
