using Domain.Entities.Stocks; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Stocks; public sealed class DividendConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable(nameof(Dividend), t => t.HasComment("SEIBro 배당분배금내역 (getDivInfo) — 종목별 배정비율·금액·시가배당율. Isin 으로 Stock 조인")); builder.HasKey(x => x.ID); builder.HasIndex(x => new { x.Isin, x.RgtStdDt }).IsUnique(); builder.HasIndex(x => x.RgtStdDt); builder.Property(x => x.Isin).HasMaxLength(12).IsFixedLength().IsRequired().HasComment("종목번호 (ISIN)"); builder.Property(x => x.KorSecnNm).HasMaxLength(100).IsRequired().HasComment("한글종목명 (KOR_SECN_NM)"); builder.Property(x => x.SecnKacdNm).HasMaxLength(20).HasComment("종목종류 (SECN_KACD_NM) — 보통주/우선주…"); builder.Property(x => x.RgtStdDt).IsRequired().HasComment("권리기준일자 (RGT_STD_DT)"); // 스펙 NUMBER(30,20)/(23,18) — SQL Server decimal 최대(38,x) 안에서 decimal(28,10) 로 안전 설정 builder.Property(x => x.Pval).HasPrecision(28, 10).HasComment("액면가 (PVAL)"); builder.Property(x => x.StkAllocRatio).HasPrecision(28, 10).HasComment("주식배정비율 (STK_ALOC_RATIO)"); builder.Property(x => x.CashAllocRatio).HasPrecision(28, 10).HasComment("현금배정비율 (CASH_ALOC_RATIO)"); builder.Property(x => x.CashAllocAmt).HasPrecision(28, 10).HasComment("현금배정금액 (CASH_ALOC_AMT) — 1주당 현금배당"); builder.Property(x => x.MartpDivRate).HasPrecision(28, 10).HasComment("시가배당율 (MARTP_DIV_RATE)"); builder.Property(x => x.Th1PayTermBeginDt).HasComment("배당지급일(현금, TH1_PAY_TERM_BEGIN_DT)"); builder.Property(x => x.DeliDt).HasComment("교부일자(주식, DELI_DT)"); builder.Property(x => x.MajshrEtcDiffAllocYn).HasComment("대주주기타차등배정여부 (MAJSHR_ETC_DIFF_ALOC_YN)"); builder.Property(x => x.TstkNoagnYn).HasComment("자사주무배정여부 (TSTK_NOAGN_YN)"); builder.Property(x => x.CashDiffDiviAmt).HasPrecision(28, 10).HasComment("현금차등배당금액 (CASH_DIFF_DIVIAMT_VAL)"); builder.Property(x => x.CashDiffDiviRate).HasPrecision(28, 10).HasComment("현금차등배당율 (CASH_DIFF_DIVI_RATE)"); builder.Property(x => x.StkDiffDiviRate).HasPrecision(28, 10).HasComment("주식차등배당율 (STK_DIFF_DIVI_RATE)"); builder.Property(x => x.MartpDiffDiviRate).HasPrecision(28, 10).HasComment("시가차등배당율 (MARTP_DIFF_DIVI_RATE)"); } }