#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'''Estension of flask_restx Resource to pass the device in the constructor'''

# System modules
from datetime import datetime

# Third-party modules
from flask_restx import Resource


class ResourceDev(Resource):
    '''Add the device to the constructor of the Resource class.
    So other resources will inherit from this,
    without always passing it to the constructor'''

    def __init__(self, *args, **kwargs):
        '''Constructor.'''
        super().__init__(self, *args, **kwargs)
        self.dev = kwargs["dev"]

    @property
    def timestamp(self):
        """Generate a iso timestamp"""
        clock = datetime.utcnow().isoformat()
        return clock
