late 0.0.1097

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
Documentation
/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api  Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal.  Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).  Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
 *
 * The version of the OpenAPI document: 1.168.0
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CommerceStore {
    /// Zernio SocialAccount id of the store.
    #[serde(rename = "accountId")]
    pub account_id: String,
    #[serde(rename = "platform")]
    pub platform: Platform,
    #[serde(rename = "name")]
    pub name: String,
    /// The platform domain of the store, e.g. my-store.myshopify.com.
    #[serde(rename = "domain")]
    pub domain: String,
    /// Public storefront URL.
    #[serde(rename = "url", deserialize_with = "Option::deserialize")]
    pub url: Option<String>,
    /// ISO 4217 code the store sells in.
    #[serde(rename = "currency")]
    pub currency: String,
    /// ISO 3166-1 alpha-2 country of the store.
    #[serde(rename = "country", deserialize_with = "Option::deserialize")]
    pub country: Option<String>,
    #[serde(rename = "capabilities")]
    pub capabilities: Vec<models::CommerceCapability>,
    /// Capabilities the platform supports that this store has not granted yet.
    #[serde(rename = "missingCapabilities")]
    pub missing_capabilities: Vec<models::CommerceCapability>,
    /// Shopify: a page in the Shopify admin where the store owner approves the permissions missingCapabilities need, on the existing install (no reinstall; they can revoke them later). Null when nothing is missing or the store cannot grant them this way (a store connected with its own custom-app token).
    #[serde(
        rename = "grantPermissionsUrl",
        deserialize_with = "Option::deserialize"
    )]
    pub grant_permissions_url: Option<String>,
}

impl CommerceStore {
    pub fn new(
        account_id: String,
        platform: Platform,
        name: String,
        domain: String,
        url: Option<String>,
        currency: String,
        country: Option<String>,
        capabilities: Vec<models::CommerceCapability>,
        missing_capabilities: Vec<models::CommerceCapability>,
        grant_permissions_url: Option<String>,
    ) -> CommerceStore {
        CommerceStore {
            account_id,
            platform,
            name,
            domain,
            url,
            currency,
            country,
            capabilities,
            missing_capabilities,
            grant_permissions_url,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
    #[serde(rename = "shopify")]
    Shopify,
    #[serde(rename = "woocommerce")]
    Woocommerce,
}

impl Default for Platform {
    fn default() -> Platform {
        Self::Shopify
    }
}