###
# #%L
# aiSSEMBLE::Test::MDA::Machine Learning::Machine Learning Training
# %%
# Copyright (C) 2021 Booz Allen
# %%
# This software package is licensed under the Booz Allen Public License. All Rights Reserved.
# #L%
###
from ...generated.post_action.onnx_keras_model_conversion_base import OnnxKerasModelConversionBase
from krausening.logging import LogManager


class ExampleOnnxKerasConversionBase(OnnxKerasModelConversionBase):
    """
    Base ExampleOnnxKerasConversion post-action class.

    GENERATED CODE - DO NOT MODIFY (add your customizations in ExampleOnnxKerasConversion).

    Generated from: templates/post-action/post.action.base.py.vm
    """
    logger = LogManager.get_instance().get_logger('ExampleOnnxKerasConversionBase')


    def __init__(self, training_run_id: str, model: any) -> None:
        """
        Default constructor for this post-action.

        :model: the model to apply this post-action on
        :training_run_id: the training run identifier associated with this post-action
        """
        super().__init__()
        self._training_run_id = training_run_id
        self._model = model


    @property
    def training_run_id(self) -> str:
        """
        The training run identifier associated with this post-action.

        :return: the training run identifier associated with this post-action.
        """
        return self._training_run_id


    @property
    def model(self) -> any:
        """
        The model to apply this post-action on.

        :return: the model to apply this post-action on
        """
        return self._model


    def apply(self) -> None:
        """
        Applies this model-conversion post-action.
        """
        ExampleOnnxKerasConversionBase.logger.info('Applying model conversion post action...')

        converted_model = self._convert(self.model)
        self._save(converted_model)

        ExampleOnnxKerasConversionBase.logger.info('Applied model conversion post action')
