#!/usr/bin/env python3.2
#
# Copyright (c) Net24 Limited, Christchurch, New Zealand 2011-2012
#       and     Voyager Internet Ltd, New Zealand, 2012-2013
#
#    This file is part of py-magcode-core.
#
#    Py-magcode-core is free software: you can redistribute it and/or modify
#    it under the terms of the GNU  General Public License as published
#    by the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Py-magcode-core is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU  General Public License for more details.
#
#    You should have received a copy of the GNU  General Public License
#    along with py-magcode-core.  If not, see <http://www.gnu.org/licenses/>.
#
"""
Resource Record comment class, corresponding to rr_comments table
"""

from magcode.core.database import *
from dms.dns import RRCLASS_IN

@saregister
class RRComment(object):
    """
    DNS Resource Record comment.
    """
    _table="rr_comments"

    def __init__(self, comment=None, tag=None):
        """
        Initialise a resource record comment

        Assign any id_ after creating instance if needed as 
        SQLAlchemy usually sets it up from DB
        """
        self.comment = comment
        self.tag = tag

    def to_engine_brief(self, time_format=None):
        """
        Output for zone engine.
        """
        return{'comment_id': self.id_, 'comment': self.comment,
                'tag': self.tag}

    to_engine = to_engine_brief


