using Domain.Entities.Stocks; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Stocks; public sealed class WorldIndexSnapshotConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable(nameof(WorldIndexSnapshot), t => t.HasComment("세계 주요국 증시지수 최신 스냅샷 (메인 세계지도 핀, 외부 소스 일1회 upsert)")); builder.HasKey(x => x.ID); builder.HasIndex(x => x.Symbol).IsUnique(); builder.HasIndex(x => x.CountryCode); builder.Property(x => x.Symbol).HasMaxLength(20).IsRequired().HasComment("외부 소스(Stooq) 심볼"); builder.Property(x => x.Name).HasMaxLength(100).IsRequired().HasComment("지수 표시명"); builder.Property(x => x.CountryCode).HasMaxLength(2).IsRequired().HasComment("국가 코드 (ISO2)"); builder.Property(x => x.ExchangeName).HasMaxLength(100).IsRequired().HasComment("거래소·시장 표기"); builder.Property(x => x.Close).HasPrecision(18, 2).HasComment("종가"); builder.Property(x => x.PrevClose).HasPrecision(18, 2).HasComment("직전 거래일 종가"); builder.Property(x => x.ChangeVal).HasPrecision(18, 2).HasComment("전일 대비"); builder.Property(x => x.FlucRateBp).HasComment("등락률 basis point (%×100)"); builder.Property(x => x.Open).HasPrecision(18, 2).HasComment("시가"); builder.Property(x => x.High).HasPrecision(18, 2).HasComment("고가"); builder.Property(x => x.Low).HasPrecision(18, 2).HasComment("저가"); builder.Property(x => x.Spark).HasMaxLength(1000).HasComment("최근 종가 스파크라인 (JSON decimal[], 과거→최신)"); } }