package com.ffii.fpsms.modules.master.entity

import com.ffii.core.entity.BaseEntity
import com.ffii.fpsms.modules.master.enums.ShopType
import com.ffii.fpsms.modules.master.enums.ShopTypeConverter
import jakarta.persistence.Column
import jakarta.persistence.Convert
import jakarta.persistence.Entity
import jakarta.persistence.Table
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Size
import java.time.LocalDateTime

@Entity
@Table(name = "shop")
open class Shop : BaseEntity<Long>() {

    @Size(max = 50)
    @NotNull
    @Column(name = "code", nullable = false, length = 50)
    open var code: String? = null

    @Size(max = 300)
    @NotNull
    @Column(name = "name", nullable = false, length = 300)
    open var name: String? = null

    @Size(max = 50)
    @Column(name = "brNo", length = 50)
    open var brNo: String? = null

    @Size(max = 50)
    @Column(name = "contactNo", length = 50)
    open var contactNo: String? = null

    @Size(max = 50)
    @Column(name = "contactEmail", length = 50)
    open var contactEmail: String? = null

    @Size(max = 50)
    @Column(name = "contactName", length = 50)
    open var contactName: String? = null

    @Size(max = 300)
    @Column(name = "addr1", length = 300)
    open var addr1: String? = null

    @Size(max = 300)
    @Column(name = "addr2", length = 300)
    open var addr2: String? = null

    @Size(max = 300)
    @Column(name = "addr3", length = 300)
    open var addr3: String? = null

    @Size(max = 300)
    @Column(name = "addr4", length = 300)
    open var addr4: String? = null

    @Size(max = 300)
    @Column(name = "district", length = 300)
    open var district: String? = null

    @Convert(converter = ShopTypeConverter::class)
    @Column(name = "type", length = 10)
    open var type: ShopType? = null

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

    @NotNull
    @Column(name = "m18LastModifyDate", nullable = false)
    open var m18LastModifyDate: LocalDateTime? = null
}