# `Ash.Policy.Policy`
[🔗](https://github.com/ash-project/ash/blob/v3.23.1/lib/ash/policy/policy.ex#L5)

Represents a policy on an Ash.Resource

# `t`

```elixir
@type t() :: %Ash.Policy.Policy{
  __spark_metadata__: Spark.Dsl.Entity.spark_meta(),
  access_type: :strict | :filter | :runtime,
  bypass?: boolean(),
  condition: nil | Ash.Policy.Check.ref() | [Ash.Policy.Check.ref()],
  description: String.t() | nil,
  policies: [Ash.Policy.Check.t()]
}
```

# `expression`

```elixir
@spec expression(
  policies ::
    t() | Ash.Policy.FieldPolicy.t() | [t() | Ash.Policy.FieldPolicy.t()],
  check_context :: Ash.Policy.Check.context()
) :: Crux.Expression.t(Ash.Policy.Check.ref())
```

# `fetch_fact`

```elixir
@spec fetch_fact(
  facts :: map(),
  check :: Ash.Policy.Check.t() | Ash.Policy.Check.ref()
) ::
  {:ok, Crux.Expression.t(Ash.Policy.Check.ref())} | :error
```

# `fetch_or_strict_check_fact`

```elixir
@spec fetch_or_strict_check_fact(
  Ash.Policy.Authorizer.t(),
  Ash.Policy.Check.t() | Ash.Policy.Check.ref()
) ::
  {:ok, Crux.Expression.t(Ash.Policy.Check.ref()), Ash.Policy.Authorizer.t()}
  | {:error, Ash.Policy.Authorizer.t()}
```

# `scenario_options`

```elixir
@spec scenario_options(check_context :: Ash.Policy.Check.context()) ::
  Crux.opts(Ash.Policy.Check.ref())
```

Default Options for Crux scenarios

# `solve`

```elixir
@spec solve(authorizer :: Ash.Policy.Authorizer.t()) ::
  {:ok, boolean() | [map()], Ash.Policy.Authorizer.t()}
  | {:error, Ash.Policy.Authorizer.t(), Ash.Error.t()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
