package gaf3.core.services.bff.entity

import gaf3.core.services.role.entity.GafRoleItem
import gaf3.core.services.user.entity.GafUserAccount
import gaf3.core.services.user.entity.GafUserInfo
import javax.persistence.*


/**
 * The persistent class for the GAF_BIND_ITEM database table.
 *
 */
@Entity(name = "GafBffUserRole")
@DiscriminatorValue("user-role")
class BffUserRole : BffBindItem() {

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "target", insertable = false, updatable = false, foreignKey = ForeignKey(value = ConstraintMode.NO_CONSTRAINT, name = "none"))
    var role: GafRoleItem? = null

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "source", insertable = false, updatable = false, foreignKey = ForeignKey(value = ConstraintMode.NO_CONSTRAINT, name = "none"))
    var user: GafUserInfo? = null

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "source", insertable = false, updatable = false, foreignKey = ForeignKey(value = ConstraintMode.NO_CONSTRAINT, name = "none"))
    var acct: GafUserAccount? = null

    companion object {
        private const val serialVersionUID = 1L
    }

}