from .enums import *
from .messages import *

ACCEPTED = AcceptedRejected.ACCEPTED
REJECTED = AcceptedRejected.REJECTED

__all__ = [
    "AcceptedRejected",
    "AcceptedDisputed",
    "AvailableRequested",
    "AgrPortfolioQuery",
    "AgrPortfolioQueryResponse",
    "AgrPortfolioQueryResponseCongestionPoint",
    "AgrPortfolioQueryResponseConnection",
    "AgrPortfolioQueryResponseDSOPortfolio",
    "AgrPortfolioQueryResponseDSOView",
    "AgrPortfolioUpdate",
    "AgrPortfolioUpdateConnection",
    "AgrPortfolioUpdateResponse",
    "ContractSettlement",
    "ContractSettlementISP",
    "ContractSettlementPeriod",
    "DPrognosis",
    "DPrognosisISP",
    "DPrognosisResponse",
    "DsoPortfolioQuery",
    "DsoPortfolioQueryCongestionPoint",
    "DsoPortfolioQueryConnection",
    "DsoPortfolioQueryResponse",
    "DsoPortfolioUpdate",
    "DsoPortfolioUpdateCongestionPoint",
    "DsoPortfolioUpdateConnection",
    "DsoPortfolioUpdateResponse",
    "FlexMessage",
    "FlexOffer",
    "FlexOfferOption",
    "FlexOfferOptionISP",
    "FlexOfferResponse",
    "FlexOfferRevocation",
    "FlexOfferRevocationResponse",
    "FlexOrder",
    "FlexOrderISP",
    "FlexOrderResponse",
    "FlexOrderSettlement",
    "FlexOrderSettlementISP",
    "FlexOrderSettlementStatus",
    "FlexOrderStatus",
    "FlexRequest",
    "FlexRequestISP",
    "FlexRequestResponse",
    "FlexReservationUpdate",
    "FlexReservationUpdateISP",
    "FlexReservationUpdateResponse",
    "FlexSettlement",
    "FlexSettlementResponse",
    "Metering",
    "MeteringISP",
    "MeteringProfile",
    "MeteringProfileEnum",
    "MeteringResponse",
    "MeteringUnit",
    "PayloadMessage",
    "PayloadMessageResponse",
    "SignedMessage",
    "TestMessage",
    "TestMessageResponse",
    "UsefRole",
    "RedispatchBy",
]

routing_map = {
    AgrPortfolioQuery: ("AGR", "CRO"),
    AgrPortfolioQueryResponse: ("CRO", "AGR"),
    AgrPortfolioUpdate: ("AGR", "CRO"),
    AgrPortfolioUpdateResponse: ("CRO", "AGR"),
    DPrognosis: ("AGR", "DSO"),
    DPrognosisResponse: ("DSO", "AGR"),
    DsoPortfolioQuery: ("DSO", "CRO"),
    DsoPortfolioQueryResponse: ("CRO", "DSO"),
    DsoPortfolioUpdate: ("DSO", "CRO"),
    DsoPortfolioUpdateResponse: ("CRO", "DSO"),
    FlexOffer: ("AGR", "DSO"),
    FlexOfferResponse: ("DSO", "AGR"),
    FlexOfferRevocation: ("AGR", "DSO"),
    FlexOfferRevocationResponse: ("DSO", "AGR"),
    FlexOrder: ("DSO", "AGR"),
    FlexOrderResponse: ("AGR", "DSO"),
    FlexRequest: ("DSO", "AGR"),
    FlexRequestResponse: ("AGR", "DSO"),
    FlexReservationUpdate: ("DSO", "AGR"),
    FlexReservationUpdateResponse: ("AGR", "DSO"),
    FlexSettlement: ("DSO", "AGR"),
    FlexSettlementResponse: ("AGR", "DSO"),
    Metering: ("AGR", "DSO"),
    MeteringResponse: ("DSO", "AGR"),
}

request_response_map = {
    AgrPortfolioQuery: AgrPortfolioQueryResponse,
    AgrPortfolioUpdate: AgrPortfolioUpdateResponse,
    DPrognosis: DPrognosisResponse,
    DsoPortfolioQuery: DsoPortfolioQueryResponse,
    DsoPortfolioUpdate: DsoPortfolioUpdateResponse,
    FlexOffer: FlexOfferResponse,
    FlexOfferRevocation: FlexOfferRevocationResponse,
    FlexOrder: FlexOrderResponse,
    FlexRequest: FlexRequestResponse,
    FlexReservationUpdate: FlexReservationUpdateResponse,
    FlexSettlement: FlexSettlementResponse,
    Metering: MeteringResponse,
    TestMessage: TestMessageResponse,
}

origin_map = {key: origin for key, (origin, destination) in routing_map.items()}
destination_map = {key: destination for key, (origin, destination) in routing_map.items()}
