Current section
Files
Jump to
Current section
Files
lib/access/services/characteristic_values/bandwidth_profile.ex
# SPDX-FileCopyrightText: 2025 diffo_example contributors <https://github.com/diffo-dev/diffo_example/graphs.contributors>
#
# SPDX-License-Identifier: MIT
defmodule DiffoExample.Access.BandwidthProfile do
@moduledoc """
Diffo - TMF Service and Resource Management with a difference
BandwidthProfile - AshTyped Struct for BandwidthProfile
"""
use Ash.TypedStruct, extensions: [AshJason.TypedStruct, AshOutstanding.TypedStruct]
jason do
pick [:downstream, :upstream, :units]
compact true
end
outstanding do
expect [:downstream, :upstream, :units]
end
typed_struct do
field :downstream, :integer,
constraints: [min: 0],
description: "the bandwidth profile downstream rate"
field :upstream, :integer,
constraints: [min: 0],
description: "the bandwidth profile upstream rate"
field :units, :atom,
default: :Mbps,
constraints: [one_of: [:kbps, :Mbps]],
description: "the bandwidth profile units"
end
end