package models

// Permission represents access control rules
type Permission struct {
	ID        []byte `gorm:"type:BINARY(16);primaryKey"`
	UserID    []byte `gorm:"column:userId;type:BINARY(16)"`
	TokenID   []byte `gorm:"column:tokenId;type:BINARY(16)"`
	OrgID     []byte `gorm:"column:orgId;type:BINARY(16);not null"`
	AccountID []byte `gorm:"column:accountId;type:BINARY(16);not null"`
	Type      uint   `gorm:"column:type;not null"`
	Inserted  uint64 `gorm:"column:inserted;not null"`
	Updated   uint64 `gorm:"column:updated;not null"`

	User    User    `gorm:"foreignKey:UserID"`
	Token   Token   `gorm:"foreignKey:TokenID"`
	Org     Org     `gorm:"foreignKey:OrgID"`
	Account Account `gorm:"foreignKey:AccountID"`
}
