#
#    Copyright (C) 2010-2018 PyTRiP98 Developers.
#
#    This file is part of PyTRiP98.
#
#    PyTRiP98 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.
#
#    PyTRiP98 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 PyTRiP98.  If not, see <http://www.gnu.org/licenses/>.
#
"""
Object holding all data needed for a specific projectile/rifi configuration.
"""


class KernelModel(object):
    """
    Kernel data, holding all necessary data for a certain projectile
    """
    projectile = None
    rifi_name = ""  # name of ripple filter, e.g. "3 mm Rifi", for documentation only
    rifi_thickness = 0.0  # thickness of RiFi in mm
    ddd_path = ""  # "/local/trip/data/ddd/*"
    spc_path = ""  # "/local/trip/data/spc/*"
    sis_path = ""  # if none, it will be autogenerated
    comment = ""  # arbitrary text
    name = ""  # name for identifying this kernel, ie.e "C12_3mmRiFi"

    def __init__(self, name=""):
        """
        """
        self.name = name

    def __str__(self):
        """
        String out handler
        """
        return self._print()

    def _print(self):
        """
        Pretty print all attributes.
        """
        out = "\n"
        out += "   Kernel '{:s}'\n".format(self.name)
        out += "----------------------------------------------------------------------------\n"
        out += "|  RiFi Name                         : '{:s}'\n".format(str(self.rifi_name))
        out += "|  RiFi Thickness [mm]               : {:.2f}\n".format(self.rifi_thickness)
        out += "|"
        out += "|  DDD Path                          : '{:s}'\n".format(str(self.ddd_path))
        out += "|  SPC Path                          : '{:s}'\n".format(str(self.spc_path))
        out += "|  SIS Path                          : '{:s}'\n".format(str(self.sis_path))
        out += "|"
        out += "|  Comment                           : '\n{:s}'\n".format(str(self.comment))
        out += "----------------------------------------------------------------------------\n"
        if self.projectile:
            out += self.projectile._print()  # TODO: maybe _print should not be marked private.
        else:
            out += "| No projectile set.\n"
        return out
