Files
policy-service/lib/policy_service/aggregates/fire_structure_policy_application.ex
HaimKortovich dfce7873fb
All checks were successful
Build and Publish / build-release (push) Successful in 1m36s
rename policy_details to insured_object
2026-04-30 13:13:41 -05:00

23 lines
808 B
Elixir

defmodule PolicyService.Aggregates.FireStructurePolicyApplication do
use PolicyService.Aggregates.PolicyApplication,
policy_type: "fire_structure",
commands: PolicyService.Commands.FireStructurePolicy
def validate_insured_object(%{
"location" => location,
"property_value" => value,
"property_use" => use_type,
"security_measures" => measures,
"market_value" => market_value
})
when is_binary(location) and byte_size(location) > 0 and
is_number(value) and value > 0 and
is_binary(use_type) and byte_size(use_type) > 0 and
is_list(measures) and
is_number(market_value) and market_value > 0 do
:ok
end
def validate_insured_object(_), do: {:error, :invalid_fire_structure_details}
end