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.
iTi-Flask/iti/exchange/plan.py

37 lines
1.1 KiB
Python

from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from .base import ExchangeOperation, ExchangeTemplateLayout, ExchangeTemplatePlan, ExchangeVariable
@dataclass(frozen=True)
class ExchangePlanInput:
biz_domain: str
biz_obj: str
operation: ExchangeOperation | str
template_id: str | None = None
version_id: str | None = None
version: str | None = None
code: str | None = None
name: str | None = None
description: str | None = None
layout: ExchangeTemplateLayout | dict[str, Any] | None = None
variables: list[ExchangeVariable] | None = None
def to_plan(self) -> ExchangeTemplatePlan:
return ExchangeTemplatePlan.from_mapping(
biz_domain=self.biz_domain,
biz_obj=self.biz_obj,
operation=self.operation,
template_id=self.template_id,
version_id=self.version_id,
version=self.version,
code=self.code,
name=self.name,
description=self.description,
layout=self.layout,
variables=self.variables,
)