{
    "$schema": "https:\/\/json-schema.org\/draft\/2020-12\/schema",
    "$id": "https:\/\/www.totalcms.co\/schemas\/auth.json",
    "type": "object",
    "id": "auth",
    "description": "A schema for a Total CMS user accounts and authentication",
    "properties": {
        "active": {
            "type": "boolean",
            "label": "Active",
            "help": "Mark this user as active",
            "field": "toggle",
            "factory": "boolean"
        },
        "id": {
            "$ref": "https:\/\/www.totalcms.co\/schemas\/properties\/slug.json",
            "label": "ID",
            "help": "A unique id for this user. If left blank, it will be auto-generated from the email address.",
            "field": "id",
            "factory": "slug",
            "settings": {
                "autogen": "${email}"
            }
        },
        "image": {
            "$ref": "https:\/\/www.totalcms.co\/schemas\/properties\/image.json",
            "label": "Profile Image",
            "help": "Profile image for this user",
            "field": "image",
            "factory": "imageShapes(512,512)"
        },
        "name": {
            "type": "string",
            "label": "Name",
            "help": "Full name of this user",
            "field": "text",
            "factory": "name"
        },
        "email": {
            "$ref": "https:\/\/www.totalcms.co\/schemas\/properties\/email.json",
            "label": "Email",
            "help": "Email address for this user",
            "field": "email",
            "factory": "email",
            "unique": true
        },
        "password": {
            "$ref": "https:\/\/www.totalcms.co\/schemas\/properties\/password.json",
            "label": "Password",
            "help": "Password for this user",
            "placeholder": "Enter password",
            "field": "password",
            "factory": "password",
            "minLength": 4,
            "settings": {
                "minlength": 4,
                "confirmPlaceholder": "Confirm password"
            }
        },
        "groups": {
            "$ref": "https:\/\/www.totalcms.co\/schemas\/properties\/list.json",
            "label": "Groups",
            "help": "Groups this user belongs to",
            "field": "list",
            "settings": {
                "accessGroupOptions": true,
                "duplicateItemsAllowed": false,
                "addChoices": false
            }
        },
        "expiration": {
            "$ref": "https:\/\/www.totalcms.co\/schemas\/properties\/date.json",
            "label": "Expiration Date",
            "help": "Account expiration date",
            "field": "date"
        },
        "maxLoginCount": {
            "type": "number",
            "label": "Maximum Login Count",
            "help": "The maximum number of times this user can login",
            "field": "number",
            "default": 0
        },
        "loginCount": {
            "type": "number",
            "label": "Login Count",
            "help": "Number of times this user has logged in",
            "field": "number",
            "default": 0,
            "settings": {
                "readonly": true
            }
        },
        "created": {
            "$ref": "https:\/\/www.totalcms.co\/schemas\/properties\/date.json",
            "label": "Creation Date",
            "help": "Date this user was created",
            "field": "datetime",
            "settings": {
                "onCreate": true,
                "readonly": true
            }
        },
        "lastlogin": {
            "$ref": "https:\/\/www.totalcms.co\/schemas\/properties\/date.json",
            "label": "Last Login",
            "help": "Last time this user logged in",
            "field": "datetime",
            "factory": "iso8601",
            "settings": {
                "readonly": true
            }
        }
    },
    "required": [
        "id",
        "created",
        "email",
        "password"
    ],
    "index": [
        "active",
        "image",
        "name",
        "email",
        "groups",
        "loginCount",
        "maxLoginCount",
        "lastlogin",
        "expiration",
        "created",
        "id"
    ],
    "formgrid": "active active\nid id\nimage image\nname name\nemail email\npassword password\ngroups loginCount\nexpiration created\nmaxLoginCount lastlogin"
}