const openid = {

    prefix: '/openid',

    middleware: [

    ],

    get: {
        '/grant-and-save/:app_id/:uid': [
            'middleware::auth:UserOnly', 'controller::OpenID.grant_and_save',
        ],
        '/interaction/:uid': [
            'controller::OpenID.handle_interaction',
        ],
        '/interaction/:uid/start-session': [
            'middleware::auth:UserOnly', 'controller::OpenID.start_session',
        ],
        '/interaction/:uid/grant': [
            'middleware::auth:UserOnly', 'controller::OpenID.process_grant',
        ],

        '/clients': [
            ['middleware::api:Permission', { check: 'v1:openid:clients:list' }],
            'controller::OpenID.get_clients',
        ],
        '/clients/:id': [
            ['middleware::api:Permission', { check: 'v1:openid:clients:get' }],
            'controller::OpenID.get_client',
        ],
    },

    post: {
        '/clients': [
            ['middleware::api:Permission', { check: 'v1:openid:clients:create' }],
            'controller::OpenID.create_client',
        ],
    },

    patch: {
        '/clients/:id': [
            ['middleware::api:Permission', { check: 'v1:openid:clients:update' }],
            'controller::OpenID.update_client',
        ],
    },

    delete: {
        '/clients/:id': [
            ['middleware::api:Permission', { check: 'v1:openid:clients:delete' }],
            'controller::OpenID.delete_client',
        ],
    },
}

module.exports = exports = openid
