/*
 * Hetzner Cloud API
 *
 * Copied from the official API documentation for the Public Hetzner Cloud.
 *
 * The version of the OpenAPI document: 4b3f595
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// Pagination : See \"Pagination\" for more information.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Pagination {
    /// Page number of the last page available. Can be null if the current page is the last one.
    #[serde(rename = "last_page", deserialize_with = "Option::deserialize")]
    pub last_page: Option<i64>,
    /// Page number of the next page. Can be null if the current page is the last one.
    #[serde(rename = "next_page", deserialize_with = "Option::deserialize")]
    pub next_page: Option<i64>,
    /// Current page number.
    #[serde(rename = "page")]
    pub page: i64,
    /// Maximum number of entries returned per page.
    #[serde(rename = "per_page")]
    pub per_page: i64,
    /// Page number of the previous page. Can be null if the current page is the first one.
    #[serde(rename = "previous_page", deserialize_with = "Option::deserialize")]
    pub previous_page: Option<i64>,
    /// Total number of entries that exist for this query. Can be null if unknown.
    #[serde(rename = "total_entries", deserialize_with = "Option::deserialize")]
    pub total_entries: Option<i64>,
}

impl Pagination {
    /// See \"Pagination\" for more information.
    pub fn new(
        last_page: Option<i64>,
        next_page: Option<i64>,
        page: i64,
        per_page: i64,
        previous_page: Option<i64>,
        total_entries: Option<i64>,
    ) -> Pagination {
        Pagination {
            last_page,
            next_page,
            page,
            per_page,
            previous_page,
            total_entries,
        }
    }
}
