package entity

import "go.mongodb.org/mongo-driver/bson/primitive"

const PermissionCollectionName = "permissions"

type Status string

const (
	StatusOpen  Status = "open"
	StatusClose Status = "close"
)

type Type string

const (
	TypeBackendUser  Type = "backend_user"
	TypeFrontendUser Type = "frontend_user"
)

type Permission struct {
	ID          primitive.ObjectID `bson:"_id,omitempty"`
	Parent      string             `bson:"parent,omitempty"`
	Name        string             `bson:"name"`
	HTTPMethods string             `bson:"http_methods,omitempty"`
	HTTPPath    string             `bson:"http_path,omitempty"`
	Status      Status             `bson:"status"`
	Type        Type               `bson:"type"`
	CreateAt    int64              `bson:"create_at"`
	UpdateAt    int64              `bson:"update_at"`
}

type RolePermission struct {
	ID           primitive.ObjectID `bson:"_id,omitempty"`
	TenantID     string             `bson:"tenant_id"`
	RoleKey      string             `bson:"role_key"`
	PermissionID string             `bson:"permission_id"`
	CreateAt     int64              `bson:"create_at"`
	UpdateAt     int64              `bson:"update_at"`
}

const RolePermissionCollectionName = "role_permissions"
