server:
  servlet:
    contextPath: /api
    encoding:
      charset: UTF-8
      enabled: true
      force: true
  port: 8090
  error:
    include-message: always

# PostCompletedDn GRN: runs daily at 00:01, processes all POs with receipt date = yesterday.
# Set enabled: false to disable. Optional receiptDate: "yyyy-MM-dd" overrides for testing only.
# m18Grn.createEnabled: M18 GRN PUT/create — false outside production so UAT/dev never posts GRNs.
scheduler:
  m18Grn:
    createEnabled: false
  postCompletedDnGrn:
    enabled: false
    # receiptDate:  # leave unset for production (uses yesterday)
  grnCodeSync:
    enabled: false   # set true in prod; backfills grn_code from M18 GET /root/api/read/an
    # Lookback: created from start of (today − N days) through now, missing grn_code. E.g. 4 = last 4 days + today.
    syncOffsetDays: 0
  inventoryLotExpiry:
    enabled: true

# Nav: PO stock_in_line pending/receiving within last N days (see ProductProcessService for 工單 QC/上架：今日+昨日).
fpsms:
  purchase-stock-in-alert:
    lookback-days: 7

spring:
  servlet:
    multipart:
      max-file-size: 500MB
      max-request-size: 600MB
  jpa:
    hibernate:
      naming:
        physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
    database-platform: org.hibernate.dialect.MySQL8Dialect
    properties:
      hibernate:
        dialect:
          storage_engine: innodb

# JWT: access token expiry and refresh token expiry. Frontend should call /refresh-token before access token expires.
# Signing key must be STABLE across server restarts (do not use a random key per boot). Override with env JWT_SECRET in production.
jwt:
  expiration-minutes: 14400      # access token: 10 days (default); override in application-prod for shorter session
  refresh-expiration-days: 30    # refresh token validity (days)
  secret: ${JWT_SECRET:fpsms-dev-jwt-signing-secret-change-for-production-use-long-random-JWT_SECRET}

logging:
  config: 'classpath:log4j2.yml'

# Optional NGPCL gateway: receives the same bytes as /plastic/download-onpack-qr-text (Content-Type: application/zip).
# Leave empty to disable; set NGPCL_PUSH_URL in production if you expose an HTTP receiver for the lemon OnPack ZIP.
ngpcl:
  push-url: ${NGPCL_PUSH_URL:}

# Laser Bag2 (/laserPrint) auto-send: same as listing + TCP send using DB LASER_PRINT.host / port / itemCodes.
# Scheduler is off by default. limit-per-run: max job orders per tick (1 = first matching only); 0 = all matches (heavy).
# sends-per-job: TCP payloads per job order per tick (1 = single send; each send may retry once on failure inside sendLaserBag2Job).
laser:
  bag2:
    auto-send:
      enabled: false
      interval-ms: 60000
      limit-per-run: 1
      sends-per-job: 1
      delay-between-sends-ms: 3000

bom:
  import:
    temp-dir: ${java.io.tmpdir}/fpsms-bom-import

m18:
  config:
    grant-type: password
    client-id: M2Y1OGYxMmQtZDRiOS00OTA4LTgyNTktZDRkNzEzNWVkMzRm
    client-secret: M2Y2YjQzYzQtZTc2Mi00OTFhLTkwYmItYmJhMzFjZjEyYmY5
    username: testingMTMS
    password: db25f2fc14cd2d2b1e7af307241f548fb03c312a
    base-url: https://toa.m18saas.com/jsf/rfws
    base-url-uat: https://toauat.m18saas.com/jsf/rfws
    base-password: qwer1234
    supplier:
      shop-po: P06, P07
      oem-po: T62
    supplier-not:
      material-po: P06, P07
    beId:
      toa: 1
      pf: 27
      pp: 29
    seriesId:
      pp: 26
      pf: 33
      fa: 2
      fb: 3
      fc: 4
      fd: 5
      ff: 6
      sc: 27
      se: 28
      sf: 70
      sr: 29