using Domain.Entities.Stocks; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Stocks; public sealed class SriBondConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable(nameof(SriBond), t => t.HasComment("사회책임투자채권(SRI) 정보 스냅샷 (KRX OpenAPI esg/sri_bond_info)")); builder.HasKey(x => x.ID); builder.HasIndex(x => new { x.Code, x.TradeDate }).IsUnique(); builder.HasIndex(x => new { x.TradeDate, x.SriBondType }); builder.Property(x => x.Code).HasMaxLength(12).IsRequired().HasComment("표준코드 (ISU_CD) — 12자리 ISIN"); builder.Property(x => x.IssuerName).HasMaxLength(100).IsRequired().HasComment("발행기관 (ISUR_NM)"); builder.Property(x => x.SriBondType).HasMaxLength(30).IsRequired().HasComment("채권종류 (SRI_BND_TP_NM)"); builder.Property(x => x.Name).HasMaxLength(100).IsRequired().HasComment("종목명 (ISU_NM)"); builder.Property(x => x.ListDate).HasComment("상장일 (LIST_DD)"); builder.Property(x => x.IssueDate).HasComment("발행일 (ISU_DD)"); builder.Property(x => x.RedemptionDate).HasComment("상환일 (REDMPT_DD)"); builder.Property(x => x.CouponRate).HasPrecision(9, 5).HasComment("표면이자율 % (ISU_RT)"); builder.Property(x => x.IssueAmount).HasComment("발행금액 (ISU_AMT, 원)"); builder.Property(x => x.ListAmount).HasComment("상장금액 (LIST_AMT, 원)"); builder.Property(x => x.BondType).HasMaxLength(30).HasComment("채권유형 (BND_TP_NM)"); } }