defmodule PolicyService.Commands.Policy do @moduledoc """ Base templates for Policy commands using TypedStruct. """ defmodule SubmitPolicyApplication do defmacro __using__(_opts) do quote do use TypedStruct typedstruct do field :id, PolicyService.Aggregates.PolicyId.t(), enforce: true field :submitted_by, String.t(), enforce: true field :insured, map(), enforce: true field :buyer, map(), enforce: true field :insured_object, map() field :selected_providers, list(), enforce: true end end end end defmodule RecordProviderQuote do defmacro __using__(_opts) do quote do use TypedStruct typedstruct do field :id, PolicyService.Aggregates.PolicyId.t(), enforce: true field :recorded_by, String.t(), enforce: true field :provider_id, String.t(), enforce: true field :quote_id, String.t(), enforce: true field :premium, String.t() field :coverage_details, map() field :valid_until, String.t(), enforce: true field :plans, list(), enforce: true end end end end defmodule AcceptQuoteAndSolicit do defmacro __using__(_opts) do quote do use TypedStruct typedstruct do field :id, PolicyService.Aggregates.PolicyId.t(), enforce: true field :accepted_by, String.t() field :accepted_plan_id, String.t(), enforce: true end end end end defmodule RecordPolicyIssued do defmacro __using__(_opts) do quote do use TypedStruct typedstruct do field :id, PolicyService.Aggregates.PolicyId.t(), enforce: true field :provider_policy_number, String.t(), enforce: true field :effective_date, String.t(), enforce: true field :expiry_date, String.t(), enforce: true field :issued_at, String.t() end end end end end