package models

import (
	"github.com/google/uuid"
	"github.com/uptrace/bun"
)

type Role struct {
	bun.BaseModel `bun:"table:roles"`
	ID            uuid.UUID `bun:"id,pk,type:uuid,default:gen_random_uuid()" json:"id"`
	Name          string    `bun:"name,unique,notnull" json:"name"`

	Permissions []Permission `bun:"m2m:permissions_to_roles,join:Role=Permission" json:"permissions,omitempty"`
}
