using System.Net;

namespace Pilz.Net.Api;

public record class ApiResult(
    HttpStatusCode StatusCode,
    ApiMessage? Message = null)
{
    public static ApiResult Ok() => new(HttpStatusCode.OK);

    public static ApiResult Ok(ApiMessage message) => new(HttpStatusCode.OK, message);

    public static ApiResult Created() => new(HttpStatusCode.Created);

    public static ApiResult Created(ApiMessage message) => new(HttpStatusCode.Created, message);

    public static ApiResult Unauthorized() => new(HttpStatusCode.Unauthorized);

    public static ApiResult NotFound() => new(HttpStatusCode.NotFound);

    public static ApiResult NoContent() => new(HttpStatusCode.NoContent);

    public static ApiResult Forbidden() => new(HttpStatusCode.Forbidden);

    public static ApiResult Locked() => new(HttpStatusCode.Locked);

    public static ApiResult TooManyRequests() => new(HttpStatusCode.TooManyRequests);

    public static ApiResult ServiceUnavailable() => new(HttpStatusCode.ServiceUnavailable);

    public static ApiResult UnavailableForLegalReasons() => new(HttpStatusCode.UnavailableForLegalReasons);

    public static ApiResult InternalServerError() => new(HttpStatusCode.InternalServerError);

    public static ApiResult BadRequest() => new(HttpStatusCode.BadRequest);

    public static ApiResult Accepted() => new(HttpStatusCode.Accepted);

    public static ApiResult NotAccepted() => new(HttpStatusCode.NotAcceptable);

    public static ApiResult MethodNotAllowed() => new(HttpStatusCode.MethodNotAllowed);
}