package com.rera.mss.model

import com.rera.mss.config.SHORT_STRING_FIELD_LENGTH
import java.io.Serializable
import javax.persistence.*

@Entity
@Table(name = "Sys_State")
data class SysState(
        @EmbeddedId
        var alternateId: StateAndEntityNameKey,

        @Column(name = "state_name", length = SHORT_STRING_FIELD_LENGTH)
        var stateName: String
)

@Embeddable
class StateAndEntityNameKey(
        @Column(name = "state")
        private var state: Int,

        @ManyToOne
        @JoinColumn(name = "entity_name")
        private var entityName: SysEntity
) : Serializable