package com.ffii.fpsms.m18.entity

import com.ffii.core.entity.BaseEntity
import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.Table
import jakarta.validation.constraints.NotNull

/**
 * Audit log for FPSMS → M18 udfBomForShop sync (request / response bodies).
 */
@Entity
@Table(name = "m18_bom_shop_sync_log")
open class M18BomShopSyncLog : BaseEntity<Long>() {

    @NotNull
    @Column(name = "bom_id", nullable = false)
    open var bomId: Long? = null

    @Column(name = "finished_item_code", length = 100)
    open var finishedItemCode: String? = null

    @Column(name = "m18_header_code", length = 200)
    open var m18HeaderCode: String? = null

    @Column(name = "request_fingerprint", length = 64)
    open var requestFingerprint: String? = null

    @Column(name = "m18_record_id")
    open var m18RecordId: Long? = null

    @NotNull
    @Column(name = "m18_api_status", nullable = false)
    open var m18ApiStatus: Boolean = false

    @NotNull
    @Column(name = "synced", nullable = false)
    open var synced: Boolean = false

    @Column(name = "message", length = 4000)
    open var message: String? = null

    @Column(name = "request_json", columnDefinition = "LONGTEXT")
    open var requestJson: String? = null

    @Column(name = "response_json", columnDefinition = "LONGTEXT")
    open var responseJson: String? = null
}
