# Path: corr-db/corrdb/common/core.py
# def setup_app(name, config='config'):


from ..core import db
from bson import ObjectId
import datetime
import json

class TrafficModel(db.Document):
    """CoRR backend traffic model.
    The traffic model countes the hits on all entities of the platform.

    Attributes:
        created_at: A string value of the creation timestamp.
        possible_service: A list of entities considered for the traffic tracking.
        service: A string value for the concerned traffic entity with undefined as default.
        endpoint: A string value of the endpoint being hit.
        periode: A string value of the current interval periode with undefined as default.
        interactions: A long value of all the hits on the endpoint.
        extend: A dictionary of to add other fields to the traffic model.
    """
    created_at = db.StringField(default=str(datetime.datetime.utcnow()))
    possible_service = ["api", "cloud", "web", "undefined"]

# Path: corr-db/corrdb/common/core.py
# def setup_app(name, config='config'):


# Path: corr-db/corrdb/common/models/traffic_model.py
from ..core import db
from bson import ObjectId
import datetime
import json


class TrafficModel(db.Document):
    """CoRR backend traffic model.
    The traffic model countes the hits on all entities of the platform.

    Attributes:
        created_at: A string value of the creation timestamp.
        possible_service: A list of entities considered for the traffic tracking.
        service: A string value for the concerned traffic entity with undefined as default.
        endpoint: A string value of the endpoint being hit.
        periode: A string value of the current interval periode with undefined as default.
        interactions: A long value of all the hits on the endpoint.
        extend: A dictionary of to add other fields to the traffic model.
    """
    created_at = db.StringField(default=str(datetime.datetime.utcnow()))
    possible_service = ["api", "cloud", "web", "undefined"]

    service = db.StringField(default="undefined", choices=possible_service)