context shop

-- A sealed, context-owned identity type (a record this context declares,
-- so it can only be minted inside the context).
type Token = { value: String }

-- Actor declarations across the admitted schemes (None / Internal), including
-- an Internal actor that yields a sealed, context-owned identity.
actor Public    { auth = None }
actor Worker    { auth = Internal }
actor Principal { auth = Internal, identity = Token }

-- A public HTTP route names its anonymous actor explicitly.
service api from http {
  on GET("/health") by v: Public () -> Effect[HttpResult[String]] {
    Ok("ok")
  }
}

-- A cron handler with the prelude Scheduler actor (the default, written here).
service jobs from cron {
  on schedule("0 * * * *") by s: Scheduler () -> Effect[Result[(), String]] {
    Ok(())
  }
}

-- A cross-context RPC surface verified by an Internal actor.
service rpc {
  on call by c: Worker () -> Effect[Result[(), String]] {
    Ok(())
  }
}
