You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Any
|
|
|
|
from .base import (
|
|
ExchangeField,
|
|
ExchangePlaceholder,
|
|
ExchangePlan,
|
|
ExchangeTemplateBinding,
|
|
ExchangeTemplateKind,
|
|
)
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ExchangeMappingPlanInput:
|
|
template_kind: ExchangeTemplateKind | str
|
|
template_id: str | None = None
|
|
version_id: str | None = None
|
|
version: str | None = None
|
|
bindings: list[ExchangeTemplateBinding] | None = None
|
|
fields: list[ExchangeField] | None = None
|
|
placeholders: list[ExchangePlaceholder] | None = None
|
|
title: str | None = None
|
|
description: str | None = None
|
|
sheet_name: str | None = None
|
|
meta: dict[str, Any] | None = None
|
|
|
|
def to_plan(self) -> ExchangePlan:
|
|
return ExchangePlan.from_mapping(
|
|
template_kind=self.template_kind,
|
|
template_id=self.template_id,
|
|
version_id=self.version_id,
|
|
version=self.version,
|
|
bindings=self.bindings,
|
|
fields=self.fields,
|
|
placeholders=self.placeholders,
|
|
title=self.title,
|
|
description=self.description,
|
|
sheet_name=self.sheet_name,
|
|
meta=self.meta,
|
|
)
|
|
|