# SPDX-FileCopyrightText: 2020 The Magma Authors.
# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
#
# SPDX-License-Identifier: BSD-3-Clause

from lte.protos.mconfig import mconfigs_pb2
from devices.device_utils import EnodebDeviceName


class EnodebConfigBuilder:
    @classmethod
    def get_mconfig(
        cls,
        device: EnodebDeviceName = EnodebDeviceName.BAICELLS,
    ) -> mconfigs_pb2.EnodebD:
        mconfig = mconfigs_pb2.EnodebD()
        mconfig.bandwidth_mhz = 20
        # This earfcndl is actually unused, remove later
        mconfig.earfcndl = 44490
        mconfig.log_level = 1
        mconfig.plmnid_list = "00101"
        mconfig.pci = 260
        mconfig.allow_enodeb_transmit = False
        mconfig.tac = 1
        if device is EnodebDeviceName.BAICELLS_QAFB:
            # fdd config
            mconfig.fdd_config.earfcndl = 9211
        elif device is EnodebDeviceName.CAVIUM:
            # fdd config
            mconfig.fdd_config.earfcndl = 2405
        else:
            # tdd config
            mconfig.tdd_config.earfcndl = 39150
            mconfig.tdd_config.subframe_assignment = 2
            mconfig.tdd_config.special_subframe_pattern = 7

        return mconfig

    @classmethod
    def get_multi_enb_mconfig(
        cls,
    ) -> mconfigs_pb2.EnodebD:
        mconfig = mconfigs_pb2.EnodebD()
        mconfig.bandwidth_mhz = 20
        mconfig.special_subframe_pattern = 7
        # This earfcndl is actually unused, remove later
        mconfig.earfcndl = 44490
        mconfig.log_level = 1
        mconfig.plmnid_list = "00101"
        mconfig.pci = 260
        mconfig.allow_enodeb_transmit = False
        mconfig.subframe_assignment = 2
        mconfig.tac = 1

        # tdd config, unused because of multi-enb config
        mconfig.tdd_config.earfcndl = 39150
        mconfig.tdd_config.subframe_assignment = 2
        mconfig.tdd_config.special_subframe_pattern = 7

        id1 = '120200002618AGP0003'
        #enb_conf_1 = mconfigs_pb2.EnodebD.EnodebConfig()
        mconfig.enb_configs_by_serial[id1]\
                .earfcndl = 39151
        mconfig.enb_configs_by_serial[id1]\
                .subframe_assignment = 2
        mconfig.enb_configs_by_serial[id1]\
                .special_subframe_pattern = 7
        mconfig.enb_configs_by_serial[id1]\
                .pci = 259
        mconfig.enb_configs_by_serial[id1]\
                .bandwidth_mhz = 20
        mconfig.enb_configs_by_serial[id1] \
            .tac = 1
        mconfig.enb_configs_by_serial[id1] \
            .cell_id = 0
        mconfig.enb_configs_by_serial[id1]\
            .transmit_enabled = True
        mconfig.enb_configs_by_serial[id1]\
            .device_class = 'Baicells Band 40'

        id2 = '120200002618AGP0004'
        #enb_conf_2 = mconfigs_pb2.EnodebD.EnodebConfig()
        mconfig.enb_configs_by_serial[id2]\
                .earfcndl = 39151
        mconfig.enb_configs_by_serial[id2]\
                .subframe_assignment = 2
        mconfig.enb_configs_by_serial[id2]\
                .special_subframe_pattern = 7
        mconfig.enb_configs_by_serial[id2]\
                .pci = 261
        mconfig.enb_configs_by_serial[id2] \
            .bandwidth_mhz = 20
        mconfig.enb_configs_by_serial[id2] \
            .tac = 1
        mconfig.enb_configs_by_serial[id2] \
            .cell_id = 0
        mconfig.enb_configs_by_serial[id2]\
                .transmit_enabled = True
        mconfig.enb_configs_by_serial[id2]\
                .device_class = 'Baicells Band 40'

        return mconfig

    @classmethod
    def get_service_config(cls):
        return {
            "tr069": {
                "interface": "eth1",
                "port": 48080,
                "perf_mgmt_port": 8081,
                "public_ip": "192.88.99.142",
            },
            "reboot_enodeb_on_mme_disconnected": True,
            "s1_interface": "eth1",
        }
