#' Normal (Gaussian) Distribution
#'
#' Makes a Normal (Gaussian) distribution.
#'
#' @param mean Mean of the distribution. Single numeric.
#' @param sd Standard deviation of the distribution.
#' Single positive numeric.
#' @returns A Normal distribution.
#' @examples
#' dst_norm(0, 1)
#' @export
dst_norm <- function(mean, sd) {
  checkmate::assert_numeric(mean, len = 1)
  checkmate::assert_numeric(sd, 0, len = 1)
  if (is.na(mean) || is.na(sd)) {
    return(dst_null())
  }
  distribution(
    .parameters = list(mean = mean, sd = sd),
    density = function(x) {
      stats::dnorm(x, mean = mean, sd = sd)
    },
    cdf = function(x) {
      stats::pnorm(x, mean = mean, sd = sd)
    },
    quantile = function(p) {
      stats::qnorm(p, mean = mean, sd = sd)
    },
    realise = function(n) {
      stats::rnorm(n, mean = mean, sd = sd)
    },
    survival = function(x) {
      stats::pnorm(x, mean = mean, sd = sd, lower.tail = FALSE)
    },
    mean = mean,
    median = mean,
    variance = sd^2,
    stdev = sd,
    skewness = 0,
    kurtosis_exc = 0,
    range = c(-Inf, Inf),
    .name = "Normal",
    .vtype = "continuous"
  )
}
