> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Inventory Deploy/CDK リファレンス

GS2-Deployのスタックを作成する際に使用するテンプレートのフォーマットと、CDKによる各種言語のテンプレート出力の実装例




## エンティティ

Deploy処理で操作の対象となるリソース

### Namespace

ネームスペース<br>

ネームスペースは、一つのプロジェクト内で同じサービスを異なる用途で複数利用するためのエンティティです。<br>
GS2 の各サービスはネームスペース単位で管理されます。ネームスペースが異なれば、同じサービスでも完全に独立したデータ空間として扱われます。<br>

そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。

#### Request

リソースの生成・更新リクエスト

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| description | string |  | |  |  ~ 1024文字 | 説明文 |
| transactionSetting | [TransactionSetting](#transactionsetting) |  | |  |  | トランザクション設定<br>アイテムの入手や消費などのインベントリ操作に対する分散トランザクション処理を設定します。シームレスな実行のための自動実行モード、複数リソースの一貫した操作のためのアトミックコミット、大規模な報酬配布のための非同期処理をサポートします。 |
| acquireScript | [ScriptSetting](#scriptsetting) |  | |  |  | アイテムを入手したときに実行するスクリプトの設定<br>Script トリガーリファレンス - [`acquire`](../script/#acquire) |
| overflowScript | [ScriptSetting](#scriptsetting) |  | |  |  | 入手上限に当たって入手できなかったときに実行するスクリプトの設定<br>Script トリガーリファレンス - [`overflowDone`](../script/#overflowdone) |
| consumeScript | [ScriptSetting](#scriptsetting) |  | |  |  | アイテムを消費するときに実行するスクリプトの設定<br>Script トリガーリファレンス - [`consume`](../script/#consume) |
| simpleItemAcquireScript | [ScriptSetting](#scriptsetting) |  | |  |  | シンプルアイテムを入手したときに実行するスクリプトの設定<br>Script トリガーリファレンス - [`simpleItemAcquire`](../script/#simpleitemacquire) |
| simpleItemConsumeScript | [ScriptSetting](#scriptsetting) |  | |  |  | シンプルアイテムを消費するときに実行するスクリプトの設定<br>Script トリガーリファレンス - [`simpleItemConsume`](../script/#simpleitemconsume) |
| bigItemAcquireScript | [ScriptSetting](#scriptsetting) |  | |  |  | 巨大アイテムを入手したときに実行するスクリプトの設定<br>Script トリガーリファレンス - [`bigItemAcquire`](../script/#bigitemacquire) |
| bigItemConsumeScript | [ScriptSetting](#scriptsetting) |  | |  |  | 巨大アイテムを消費するときに実行するスクリプトの設定<br>Script トリガーリファレンス - [`bigItemConsume`](../script/#bigitemconsume) |
| logSetting | [LogSetting](#logsetting) |  | |  |  | ログの出力設定<br>インベントリ操作のAPIリクエスト・レスポンスログを出力するためのGS2-Logネームスペースを指定します。デバッグや分析のためにアイテムの入手、消費、容量変更の追跡に便利です。 |

#### GetAttr

[!GetAttr](/articles/tech/deploy/#getattr)タグで取得可能なリソースの生成結果

| | 型 | 説明 |
| --- | --- | --- |
| Item | [Namespace](../sdk#namespace) | 作成したネームスペース

#### 実装例




**GS2-Deploy(YAML)**
```yaml

Type: GS2::Inventory::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSetting: null
  AcquireScript: null
  OverflowScript: null
  ConsumeScript: null
  SimpleItemAcquireScript: null
  SimpleItemConsumeScript: null
  BigItemAcquireScript: null
  BigItemConsumeScript: null
  LogSetting: 
    LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001

```

**Go**
```go

import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/inventory"
)


SampleStack := core.NewStack()
inventory.NewNamespace(
    &SampleStack,
    "namespace-0001",
    inventory.NamespaceOptions{
        LogSetting: &core.LogSetting{
            LoggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
        },
    },
)

println(SampleStack.Yaml())  // Generate Template

```

**PHP**
```php

class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Inventory\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Inventory\Model\Options\NamespaceOptions(
                logSetting: new \Gs2Cdk\Core\Model\LogSetting(
                    loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            )
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template

```

**Java**
```java

class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.inventory.model.Namespace(
                this,
                "namespace-0001",
                new io.gs2.cdk.inventory.model.options.NamespaceOptions()
                        .withLogSetting(new io.gs2.cdk.core.model.LogSetting(
                            "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                        ))
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template

```

**C#**
```csharp

public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Inventory.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2Inventory.Model.Options.NamespaceOptions
            {
                logSetting = new Gs2Cdk.Core.Model.LogSetting(
                    loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

```

**TypeScript**
```typescript

import core from "@/gs2cdk/core";
import inventory from "@/gs2cdk/inventory";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new inventory.model.Namespace(
            this,
            "namespace-0001",
            {
                logSetting: new core.LogSetting(
                    "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template

```

**Python**
```python

from gs2_cdk import Stack, core, inventory

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        inventory.Namespace(
            stack=self,
            name='namespace-0001',
            options=inventory.NamespaceOptions(
                log_setting=core.LogSetting(
                    logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
                ),
            ),
        )

print(SampleStack().yaml())  # Generate Template

```


#### TransactionSetting

トランザクション設定<br>

トランザクション設定は、トランザクションの実行方法・整合性・非同期処理・競合回避の仕組みを制御する設定です。<br>
自動実行（AutoRun）、アトミック実行（AtomicCommit）、GS2-Distributor を利用した非同期実行、スクリプト結果の一括適用、GS2-JobQueue による入手アクションの非同期化などを組み合わせ、ゲームロジックに応じた堅牢なトランザクション管理を可能にします。

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| enableAutoRun | bool |  |  | false |  | 発行したトランザクションをサーバーサイドで自動的に実行するか |
| enableAtomicCommit | bool | {enableAutoRun} == true |  | false |  | トランザクションの実行をアトミックにコミットするか<br>※ enableAutoRun が true であれば 有効 |
| transactionUseDistributor | bool | {enableAtomicCommit} == true |  | false |  | トランザクションを非同期処理で実行する<br>※ enableAtomicCommit が true であれば 有効 |
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true |  | false |  | スクリプトの結果コミット処理を非同期処理で実行するか<br>※ transactionUseDistributor が true であれば 有効 |
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true |  | false |  | 入手アクションを実行する際に GS2-JobQueue を使用するか<br>※ enableAtomicCommit が true であれば 有効 |
| distributorNamespaceId | string |  |  | "grn:gs2:{region}:{ownerId}:distributor:default" |  ~ 1024文字 | トランザクションの実行に使用する GS2-Distributor ネームスペースGRN |
| queueNamespaceId | string |  |  | "grn:gs2:{region}:{ownerId}:queue:default" |  ~ 1024文字 | トランザクションの実行に使用する GS2-JobQueue のネームスペースGRN |

#### ScriptSetting

スクリプト設定<br>

GS2 ではマイクロサービスのイベントに関連づけて、カスタムスクリプトを実行することができます。<br>
このモデルは、スクリプトの実行をトリガーするための設定を保持します。<br>

スクリプトの実行方式は大きく2種類あり、それは「同期実行」と「非同期実行」です。<br>
同期実行は、スクリプトの実行が完了するまで処理がブロックされます。<br>
代わりに、スクリプトの実行結果を使って API の実行を止めたり、API のレスポンス内容を制御することができます。<br>

一方、非同期実行ではスクリプトの完了を待つために処理がブロックされることはありません。<br>
ただし、スクリプトの実行結果を利用して API の実行を停止したり、API の応答内容を変更することはできません。<br>
非同期実行は API の応答フローに影響を与えないため、原則として非同期実行を推奨します。<br>

非同期実行には実行方式が2種類あり、GS2-Script と Amazon EventBridge があります。<br>
Amazon EventBridge を使用することで、Lua 以外の言語で処理を記述することができます。

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| triggerScriptId | string |  |  |  |  ~ 1024文字 | API 実行時に同期的に実行される GS2-Script のスクリプトGRN<br>「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。 |
| doneTriggerTargetType | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"none",<br>&nbsp;&nbsp;"gs2_script",<br>&nbsp;&nbsp;"aws"<br>}<br> |  |  | "none" |  | 非同期スクリプトの実行方法<br>非同期実行で使用するスクリプトの種類を指定します。<br>「非同期実行のスクリプトを使用しない(none)」「GS2-Scriptを使用する(gs2_script)」「Amazon EventBridgeを使用する(aws)」が選択できます。"none": なし / "gs2_script": GS2-Script / "aws": Amazon EventBridge /  |
| doneTriggerScriptId | string | {doneTriggerTargetType} == "gs2_script" |  |  |  ~ 1024文字 | 非同期実行する GS2-Script スクリプトGRN<br>「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。<br>※ doneTriggerTargetType が "gs2_script" であれば 有効 |
| doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == "gs2_script" |  |  |  ~ 1024文字 | 非同期実行スクリプトを実行する GS2-JobQueue ネームスペースGRN<br>非同期実行スクリプトを直接実行するのではなく、GS2-JobQueue を経由する場合は GS2-JobQueue のネームスペースGRN を指定します。<br>GS2-JobQueue を利用する理由は多くはありませんので、特に理由がなければ指定する必要はありません。<br>※ doneTriggerTargetType が "gs2_script" であれば 有効 |

#### LogSetting

ログの出力設定<br>

ログデータの出力設定を管理します。この型は、ログデータを書き出すために使用される GS2-Log ネームスペースの識別子（Namespace ID）を保持します。<br>
ログネームスペースID(loggingNamespaceId)には、ログデータを収集し保存する GS2-Log のネームスペースを、GRNの形式で指定します。<br>
この設定をすることで、設定されたネームスペース内で発生したAPIリクエスト・レスポンスのログデータが、対象の GS2-Log ネームスペース側へ出力されるようになります。<br>
GS2-Log ではリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| loggingNamespaceId | string |  | ✓ |  |  ~ 1024文字 | ログを出力する GS2-Log のネームスペースGRN<br>「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。 |

---

### CurrentItemModelMaster

現在アクティブなアイテムモデルのマスターデータ<br>

現在ネームスペース内で有効な、アイテムモデルの定義を記述したマスターデータです。<br>
GS2ではマスターデータの管理にJSON形式のファイルを使用します。<br>
ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。<br>

JSONファイルを作成する方法として、マネージメントコンソール内にマスターデータエディタを提供しています。<br>
また、よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。
{{% alert title="Note" color="info" %}}
JSONファイルの形式については [GS2-Inventory マスターデータリファレンス](api_reference/inventory/master_data/) をご参照ください。
{{% /alert %}}

#### Request

リソースの生成・更新リクエスト

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128文字 | ネームスペース名<br>ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| mode | 文字列列挙型<br>enum {<br>&nbsp;&nbsp;"direct",<br>&nbsp;&nbsp;"preUpload"<br>}<br> |  | | "direct" |  | 更新モード"direct": マスターデータを直接更新 / "preUpload": マスターデータをアップロードしてから更新 /  |
| settings | string | {mode} == "direct" | ✓※|  |  ~ 5242880 バイト (5MB) | マスターデータ<br>※ mode が "direct" であれば必須 |
| uploadToken | string | {mode} == "preUpload" | ✓※|  |  ~ 1024文字 | 事前アップロードで取得したトークン<br>アップロードしたマスターデータを適用するために使用されます。<br>※ mode が "preUpload" であれば必須 |

#### GetAttr

[!GetAttr](/articles/tech/deploy/#getattr)タグで取得可能なリソースの生成結果

| | 型 | 説明 |
| --- | --- | --- |
| Item | [CurrentItemModelMaster](../sdk#currentitemmodelmaster) | 更新された現在アクティブなアイテムモデルのマスターデータ

#### 実装例




**GS2-Deploy(YAML)**
```yaml

Type: GS2::Inventory::CurrentItemModelMaster
Properties:
  NamespaceName: namespace-0001
  Mode: direct
  Settings: {
    "version": "2019-02-05",
    "inventoryModels": [
      {
        "name": "item",
        "initialCapacity": 100,
        "maxCapacity": 999,
        "itemModels": [
          {
            "name": "item-0001",
            "metadata": "ITEM_0001",
            "stackingLimit": 99,
            "allowMultipleStacks": false,
            "sortValue": 1
          },
          {
            "name": "item-0002",
            "metadata": "ITEM_0002",
            "stackingLimit": 49,
            "allowMultipleStacks": true,
            "sortValue": 2
          },
          {
            "name": "item-0003",
            "metadata": "ITEM_0003",
            "stackingLimit": 9,
            "allowMultipleStacks": false,
            "sortValue": 3
          }
        ],
        "metadata": "INVENTORY_ITEM"
      },
      {
        "name": "character",
        "initialCapacity": 50,
        "maxCapacity": 99,
        "itemModels": [
          {
            "name": "character-0001",
            "metadata": "CHARACTER_0001",
            "stackingLimit": 99,
            "allowMultipleStacks": false,
            "sortValue": 1
          },
          {
            "name": "character-0002",
            "metadata": "CHARACTER_0002",
            "stackingLimit": 49,
            "allowMultipleStacks": true,
            "sortValue": 2
          },
          {
            "name": "character-0003",
            "metadata": "CHARACTER_0003",
            "stackingLimit": 9,
            "allowMultipleStacks": false,
            "sortValue": 3
          }
        ],
        "metadata": "INVENTORY_CHARACTER"
      }
    ],
    "simpleInventoryModels": [
      {
        "name": "item",
        "simpleItemModels": [
          {
            "name": "item-0001",
            "metadata": "ITEM_0001"
          },
          {
            "name": "item-0002",
            "metadata": "ITEM_0002"
          },
          {
            "name": "item-0003",
            "metadata": "ITEM_0003"
          }
        ],
        "metadata": "INVENTORY_ITEM"
      }
    ],
    "bigInventoryModels": [
      {
        "name": "item",
        "bigItemModels": [
          {
            "name": "item-0001",
            "metadata": "ITEM_0001"
          },
          {
            "name": "item-0002",
            "metadata": "ITEM_0002"
          },
          {
            "name": "item-0003",
            "metadata": "ITEM_0003"
          }
        ],
        "metadata": "INVENTORY_ITEM"
      }
    ]
  }
  UploadToken: null

```

**Go**
```go

import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/inventory"
    "github.com/openlyinc/pointy"
)


SampleStack := core.NewStack()
inventory.NewNamespace(
    &SampleStack,
    "namespace-0001",
    inventory.NamespaceOptions{},
).MasterData(
    []inventory.InventoryModel{
        inventory.NewInventoryModel(
            "item",
            100,
            999,
            []inventory.ItemModel{
                inventory.NewItemModel(
                    "item-0001",
                    99,
                    false,
                    1,
                    inventory.ItemModelOptions{
                        Metadata: pointy.String("ITEM_0001"),
                    },
                ),
                inventory.NewItemModel(
                    "item-0002",
                    49,
                    true,
                    2,
                    inventory.ItemModelOptions{
                        Metadata: pointy.String("ITEM_0002"),
                    },
                ),
                inventory.NewItemModel(
                    "item-0003",
                    9,
                    false,
                    3,
                    inventory.ItemModelOptions{
                        Metadata: pointy.String("ITEM_0003"),
                    },
                ),
            },
            inventory.InventoryModelOptions{
                Metadata: pointy.String("INVENTORY_ITEM"),
            },
        ),
        inventory.NewInventoryModel(
            "character",
            50,
            99,
            []inventory.ItemModel{
                inventory.NewItemModel(
                    "character-0001",
                    99,
                    false,
                    1,
                    inventory.ItemModelOptions{
                        Metadata: pointy.String("CHARACTER_0001"),
                    },
                ),
                inventory.NewItemModel(
                    "character-0002",
                    49,
                    true,
                    2,
                    inventory.ItemModelOptions{
                        Metadata: pointy.String("CHARACTER_0002"),
                    },
                ),
                inventory.NewItemModel(
                    "character-0003",
                    9,
                    false,
                    3,
                    inventory.ItemModelOptions{
                        Metadata: pointy.String("CHARACTER_0003"),
                    },
                ),
            },
            inventory.InventoryModelOptions{
                Metadata: pointy.String("INVENTORY_CHARACTER"),
            },
        ),
    },
    []inventory.SimpleInventoryModel{
        inventory.NewSimpleInventoryModel(
            "item",
            []inventory.SimpleItemModel{
                inventory.NewSimpleItemModel(
                    "item-0001",
                    inventory.SimpleItemModelOptions{
                        Metadata: pointy.String("ITEM_0001"),
                    },
                ),
                inventory.NewSimpleItemModel(
                    "item-0002",
                    inventory.SimpleItemModelOptions{
                        Metadata: pointy.String("ITEM_0002"),
                    },
                ),
                inventory.NewSimpleItemModel(
                    "item-0003",
                    inventory.SimpleItemModelOptions{
                        Metadata: pointy.String("ITEM_0003"),
                    },
                ),
            },
            inventory.SimpleInventoryModelOptions{
                Metadata: pointy.String("INVENTORY_ITEM"),
            },
        ),
    },
    []inventory.BigInventoryModel{
        inventory.NewBigInventoryModel(
            "item",
            []inventory.BigItemModel{
                inventory.NewBigItemModel(
                    "item-0001",
                    inventory.BigItemModelOptions{
                        Metadata: pointy.String("ITEM_0001"),
                    },
                ),
                inventory.NewBigItemModel(
                    "item-0002",
                    inventory.BigItemModelOptions{
                        Metadata: pointy.String("ITEM_0002"),
                    },
                ),
                inventory.NewBigItemModel(
                    "item-0003",
                    inventory.BigItemModelOptions{
                        Metadata: pointy.String("ITEM_0003"),
                    },
                ),
            },
            inventory.BigInventoryModelOptions{
                Metadata: pointy.String("INVENTORY_ITEM"),
            },
        ),
    },
)

println(SampleStack.Yaml())  // Generate Template

```

**PHP**
```php

class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Inventory\Model\Namespace_(
            stack: $this,
            name: "namespace-0001"
        ))->masterData(
            [
                new \Gs2Cdk\Inventory\Model\InventoryModel(
                    name:"item",
                    initialCapacity:100,
                    maxCapacity:999,
                    itemModels:[
                        new \Gs2Cdk\Inventory\Model\ItemModel(
                            name: "item-0001",
                            stackingLimit: 99,
                            allowMultipleStacks: false,
                            sortValue: 1,
                            options: new \Gs2Cdk\Inventory\Model\Options\ItemModelOptions(
                                metadata: "ITEM_0001",
                            ),
                        ),
                        new \Gs2Cdk\Inventory\Model\ItemModel(
                            name: "item-0002",
                            stackingLimit: 49,
                            allowMultipleStacks: true,
                            sortValue: 2,
                            options: new \Gs2Cdk\Inventory\Model\Options\ItemModelOptions(
                                metadata: "ITEM_0002",
                            ),
                        ),
                        new \Gs2Cdk\Inventory\Model\ItemModel(
                            name: "item-0003",
                            stackingLimit: 9,
                            allowMultipleStacks: false,
                            sortValue: 3,
                            options: new \Gs2Cdk\Inventory\Model\Options\ItemModelOptions(
                                metadata: "ITEM_0003",
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Inventory\Model\Options\InventoryModelOptions(
                        metadata:"INVENTORY_ITEM"
                    )
                ),
                new \Gs2Cdk\Inventory\Model\InventoryModel(
                    name:"character",
                    initialCapacity:50,
                    maxCapacity:99,
                    itemModels:[
                        new \Gs2Cdk\Inventory\Model\ItemModel(
                            name: "character-0001",
                            stackingLimit: 99,
                            allowMultipleStacks: false,
                            sortValue: 1,
                            options: new \Gs2Cdk\Inventory\Model\Options\ItemModelOptions(
                                metadata: "CHARACTER_0001",
                            ),
                        ),
                        new \Gs2Cdk\Inventory\Model\ItemModel(
                            name: "character-0002",
                            stackingLimit: 49,
                            allowMultipleStacks: true,
                            sortValue: 2,
                            options: new \Gs2Cdk\Inventory\Model\Options\ItemModelOptions(
                                metadata: "CHARACTER_0002",
                            ),
                        ),
                        new \Gs2Cdk\Inventory\Model\ItemModel(
                            name: "character-0003",
                            stackingLimit: 9,
                            allowMultipleStacks: false,
                            sortValue: 3,
                            options: new \Gs2Cdk\Inventory\Model\Options\ItemModelOptions(
                                metadata: "CHARACTER_0003",
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Inventory\Model\Options\InventoryModelOptions(
                        metadata:"INVENTORY_CHARACTER"
                    )
                )
            ],
            [
                new \Gs2Cdk\Inventory\Model\SimpleInventoryModel(
                    name:"item",
                    simpleItemModels:[
                        new \Gs2Cdk\Inventory\Model\SimpleItemModel(
                            name: "item-0001",
                            options: new \Gs2Cdk\Inventory\Model\Options\SimpleItemModelOptions(
                                metadata: "ITEM_0001",
                            ),
                        ),
                        new \Gs2Cdk\Inventory\Model\SimpleItemModel(
                            name: "item-0002",
                            options: new \Gs2Cdk\Inventory\Model\Options\SimpleItemModelOptions(
                                metadata: "ITEM_0002",
                            ),
                        ),
                        new \Gs2Cdk\Inventory\Model\SimpleItemModel(
                            name: "item-0003",
                            options: new \Gs2Cdk\Inventory\Model\Options\SimpleItemModelOptions(
                                metadata: "ITEM_0003",
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Inventory\Model\Options\SimpleInventoryModelOptions(
                        metadata:"INVENTORY_ITEM"
                    )
                )
            ],
            [
                new \Gs2Cdk\Inventory\Model\BigInventoryModel(
                    name:"item",
                    bigItemModels:[
                        new \Gs2Cdk\Inventory\Model\BigItemModel(
                            name: "item-0001",
                            options: new \Gs2Cdk\Inventory\Model\Options\BigItemModelOptions(
                                metadata: "ITEM_0001",
                            ),
                        ),
                        new \Gs2Cdk\Inventory\Model\BigItemModel(
                            name: "item-0002",
                            options: new \Gs2Cdk\Inventory\Model\Options\BigItemModelOptions(
                                metadata: "ITEM_0002",
                            ),
                        ),
                        new \Gs2Cdk\Inventory\Model\BigItemModel(
                            name: "item-0003",
                            options: new \Gs2Cdk\Inventory\Model\Options\BigItemModelOptions(
                                metadata: "ITEM_0003",
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Inventory\Model\Options\BigInventoryModelOptions(
                        metadata:"INVENTORY_ITEM"
                    )
                )
            ]
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template

```

**Java**
```java

class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.inventory.model.Namespace(
            this,
            "namespace-0001"
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.inventory.model.InventoryModel(
                    "item",
                    100,
                    999,
                    Arrays.asList(
                        new io.gs2.cdk.inventory.model.ItemModel(
                            "item-0001",
                            99L,
                            false,
                            1,
                            new io.gs2.cdk.inventory.model.options.ItemModelOptions()
                                .withMetadata("ITEM_0001")
                        ),
                        new io.gs2.cdk.inventory.model.ItemModel(
                            "item-0002",
                            49L,
                            true,
                            2,
                            new io.gs2.cdk.inventory.model.options.ItemModelOptions()
                                .withMetadata("ITEM_0002")
                        ),
                        new io.gs2.cdk.inventory.model.ItemModel(
                            "item-0003",
                            9L,
                            false,
                            3,
                            new io.gs2.cdk.inventory.model.options.ItemModelOptions()
                                .withMetadata("ITEM_0003")
                        )
                    ),
                    new io.gs2.cdk.inventory.model.options.InventoryModelOptions()
                        .withMetadata("INVENTORY_ITEM")
                ),
                new io.gs2.cdk.inventory.model.InventoryModel(
                    "character",
                    50,
                    99,
                    Arrays.asList(
                        new io.gs2.cdk.inventory.model.ItemModel(
                            "character-0001",
                            99L,
                            false,
                            1,
                            new io.gs2.cdk.inventory.model.options.ItemModelOptions()
                                .withMetadata("CHARACTER_0001")
                        ),
                        new io.gs2.cdk.inventory.model.ItemModel(
                            "character-0002",
                            49L,
                            true,
                            2,
                            new io.gs2.cdk.inventory.model.options.ItemModelOptions()
                                .withMetadata("CHARACTER_0002")
                        ),
                        new io.gs2.cdk.inventory.model.ItemModel(
                            "character-0003",
                            9L,
                            false,
                            3,
                            new io.gs2.cdk.inventory.model.options.ItemModelOptions()
                                .withMetadata("CHARACTER_0003")
                        )
                    ),
                    new io.gs2.cdk.inventory.model.options.InventoryModelOptions()
                        .withMetadata("INVENTORY_CHARACTER")
                )
            ),
            Arrays.asList(
                new io.gs2.cdk.inventory.model.SimpleInventoryModel(
                    "item",
                    Arrays.asList(
                        new io.gs2.cdk.inventory.model.SimpleItemModel(
                            "item-0001",
                            new io.gs2.cdk.inventory.model.options.SimpleItemModelOptions()
                                .withMetadata("ITEM_0001")
                        ),
                        new io.gs2.cdk.inventory.model.SimpleItemModel(
                            "item-0002",
                            new io.gs2.cdk.inventory.model.options.SimpleItemModelOptions()
                                .withMetadata("ITEM_0002")
                        ),
                        new io.gs2.cdk.inventory.model.SimpleItemModel(
                            "item-0003",
                            new io.gs2.cdk.inventory.model.options.SimpleItemModelOptions()
                                .withMetadata("ITEM_0003")
                        )
                    ),
                    new io.gs2.cdk.inventory.model.options.SimpleInventoryModelOptions()
                        .withMetadata("INVENTORY_ITEM")
                )
            ),
            Arrays.asList(
                new io.gs2.cdk.inventory.model.BigInventoryModel(
                    "item",
                    Arrays.asList(
                        new io.gs2.cdk.inventory.model.BigItemModel(
                            "item-0001",
                            new io.gs2.cdk.inventory.model.options.BigItemModelOptions()
                                .withMetadata("ITEM_0001")
                        ),
                        new io.gs2.cdk.inventory.model.BigItemModel(
                            "item-0002",
                            new io.gs2.cdk.inventory.model.options.BigItemModelOptions()
                                .withMetadata("ITEM_0002")
                        ),
                        new io.gs2.cdk.inventory.model.BigItemModel(
                            "item-0003",
                            new io.gs2.cdk.inventory.model.options.BigItemModelOptions()
                                .withMetadata("ITEM_0003")
                        )
                    ),
                    new io.gs2.cdk.inventory.model.options.BigInventoryModelOptions()
                        .withMetadata("INVENTORY_ITEM")
                )
            )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template

```

**C#**
```csharp

public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Inventory.Model.Namespace(
            stack: this,
            name: "namespace-0001"
        ).MasterData(
            new Gs2Cdk.Gs2Inventory.Model.InventoryModel[] {
                new Gs2Cdk.Gs2Inventory.Model.InventoryModel(
                    name: "item",
                    initialCapacity: 100,
                    maxCapacity: 999,
                    itemModels: new Gs2Cdk.Gs2Inventory.Model.ItemModel[]
                    {
                        new Gs2Cdk.Gs2Inventory.Model.ItemModel(
                            name: "item-0001",
                            stackingLimit: 99L,
                            allowMultipleStacks: false,
                            sortValue: 1,
                            options: new Gs2Cdk.Gs2Inventory.Model.Options.ItemModelOptions
                            {
                                metadata = "ITEM_0001"
                            }
                        ),
                        new Gs2Cdk.Gs2Inventory.Model.ItemModel(
                            name: "item-0002",
                            stackingLimit: 49L,
                            allowMultipleStacks: true,
                            sortValue: 2,
                            options: new Gs2Cdk.Gs2Inventory.Model.Options.ItemModelOptions
                            {
                                metadata = "ITEM_0002"
                            }
                        ),
                        new Gs2Cdk.Gs2Inventory.Model.ItemModel(
                            name: "item-0003",
                            stackingLimit: 9L,
                            allowMultipleStacks: false,
                            sortValue: 3,
                            options: new Gs2Cdk.Gs2Inventory.Model.Options.ItemModelOptions
                            {
                                metadata = "ITEM_0003"
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Inventory.Model.Options.InventoryModelOptions
                    {
                        metadata = "INVENTORY_ITEM"
                    }
                ),
                new Gs2Cdk.Gs2Inventory.Model.InventoryModel(
                    name: "character",
                    initialCapacity: 50,
                    maxCapacity: 99,
                    itemModels: new Gs2Cdk.Gs2Inventory.Model.ItemModel[]
                    {
                        new Gs2Cdk.Gs2Inventory.Model.ItemModel(
                            name: "character-0001",
                            stackingLimit: 99L,
                            allowMultipleStacks: false,
                            sortValue: 1,
                            options: new Gs2Cdk.Gs2Inventory.Model.Options.ItemModelOptions
                            {
                                metadata = "CHARACTER_0001"
                            }
                        ),
                        new Gs2Cdk.Gs2Inventory.Model.ItemModel(
                            name: "character-0002",
                            stackingLimit: 49L,
                            allowMultipleStacks: true,
                            sortValue: 2,
                            options: new Gs2Cdk.Gs2Inventory.Model.Options.ItemModelOptions
                            {
                                metadata = "CHARACTER_0002"
                            }
                        ),
                        new Gs2Cdk.Gs2Inventory.Model.ItemModel(
                            name: "character-0003",
                            stackingLimit: 9L,
                            allowMultipleStacks: false,
                            sortValue: 3,
                            options: new Gs2Cdk.Gs2Inventory.Model.Options.ItemModelOptions
                            {
                                metadata = "CHARACTER_0003"
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Inventory.Model.Options.InventoryModelOptions
                    {
                        metadata = "INVENTORY_CHARACTER"
                    }
                )
            },
            new Gs2Cdk.Gs2Inventory.Model.SimpleInventoryModel[] {
                new Gs2Cdk.Gs2Inventory.Model.SimpleInventoryModel(
                    name: "item",
                    simpleItemModels: new Gs2Cdk.Gs2Inventory.Model.SimpleItemModel[]
                    {
                        new Gs2Cdk.Gs2Inventory.Model.SimpleItemModel(
                            name: "item-0001",
                            options: new Gs2Cdk.Gs2Inventory.Model.Options.SimpleItemModelOptions
                            {
                                metadata = "ITEM_0001"
                            }
                        ),
                        new Gs2Cdk.Gs2Inventory.Model.SimpleItemModel(
                            name: "item-0002",
                            options: new Gs2Cdk.Gs2Inventory.Model.Options.SimpleItemModelOptions
                            {
                                metadata = "ITEM_0002"
                            }
                        ),
                        new Gs2Cdk.Gs2Inventory.Model.SimpleItemModel(
                            name: "item-0003",
                            options: new Gs2Cdk.Gs2Inventory.Model.Options.SimpleItemModelOptions
                            {
                                metadata = "ITEM_0003"
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Inventory.Model.Options.SimpleInventoryModelOptions
                    {
                        metadata = "INVENTORY_ITEM"
                    }
                )
            },
            new Gs2Cdk.Gs2Inventory.Model.BigInventoryModel[] {
                new Gs2Cdk.Gs2Inventory.Model.BigInventoryModel(
                    name: "item",
                    bigItemModels: new Gs2Cdk.Gs2Inventory.Model.BigItemModel[]
                    {
                        new Gs2Cdk.Gs2Inventory.Model.BigItemModel(
                            name: "item-0001",
                            options: new Gs2Cdk.Gs2Inventory.Model.Options.BigItemModelOptions
                            {
                                metadata = "ITEM_0001"
                            }
                        ),
                        new Gs2Cdk.Gs2Inventory.Model.BigItemModel(
                            name: "item-0002",
                            options: new Gs2Cdk.Gs2Inventory.Model.Options.BigItemModelOptions
                            {
                                metadata = "ITEM_0002"
                            }
                        ),
                        new Gs2Cdk.Gs2Inventory.Model.BigItemModel(
                            name: "item-0003",
                            options: new Gs2Cdk.Gs2Inventory.Model.Options.BigItemModelOptions
                            {
                                metadata = "ITEM_0003"
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Inventory.Model.Options.BigInventoryModelOptions
                    {
                        metadata = "INVENTORY_ITEM"
                    }
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

```

**TypeScript**
```typescript

import core from "@/gs2cdk/core";
import inventory from "@/gs2cdk/inventory";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new inventory.model.Namespace(
            this,
            "namespace-0001",
        ).masterData(
            [
                new inventory.model.InventoryModel(
                    "item",
                    100,
                    999,
                    [
                        new inventory.model.ItemModel(
                            "item-0001",
                            99,
                            false,
                            1,
                            {
                                metadata: "ITEM_0001"
                            }
                        ),
                        new inventory.model.ItemModel(
                            "item-0002",
                            49,
                            true,
                            2,
                            {
                                metadata: "ITEM_0002"
                            }
                        ),
                        new inventory.model.ItemModel(
                            "item-0003",
                            9,
                            false,
                            3,
                            {
                                metadata: "ITEM_0003"
                            }
                        ),
                    ],
                    {
                        metadata: "INVENTORY_ITEM"
                    }
                ),
                new inventory.model.InventoryModel(
                    "character",
                    50,
                    99,
                    [
                        new inventory.model.ItemModel(
                            "character-0001",
                            99,
                            false,
                            1,
                            {
                                metadata: "CHARACTER_0001"
                            }
                        ),
                        new inventory.model.ItemModel(
                            "character-0002",
                            49,
                            true,
                            2,
                            {
                                metadata: "CHARACTER_0002"
                            }
                        ),
                        new inventory.model.ItemModel(
                            "character-0003",
                            9,
                            false,
                            3,
                            {
                                metadata: "CHARACTER_0003"
                            }
                        ),
                    ],
                    {
                        metadata: "INVENTORY_CHARACTER"
                    }
                )
            ],
            [
                new inventory.model.SimpleInventoryModel(
                    "item",
                    [
                        new inventory.model.SimpleItemModel(
                            "item-0001",
                            {
                                metadata: "ITEM_0001"
                            }
                        ),
                        new inventory.model.SimpleItemModel(
                            "item-0002",
                            {
                                metadata: "ITEM_0002"
                            }
                        ),
                        new inventory.model.SimpleItemModel(
                            "item-0003",
                            {
                                metadata: "ITEM_0003"
                            }
                        ),
                    ],
                    {
                        metadata: "INVENTORY_ITEM"
                    }
                )
            ],
            [
                new inventory.model.BigInventoryModel(
                    "item",
                    [
                        new inventory.model.BigItemModel(
                            "item-0001",
                            {
                                metadata: "ITEM_0001"
                            }
                        ),
                        new inventory.model.BigItemModel(
                            "item-0002",
                            {
                                metadata: "ITEM_0002"
                            }
                        ),
                        new inventory.model.BigItemModel(
                            "item-0003",
                            {
                                metadata: "ITEM_0003"
                            }
                        ),
                    ],
                    {
                        metadata: "INVENTORY_ITEM"
                    }
                )
            ]
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template

```

**Python**
```python

from gs2_cdk import Stack, core, inventory

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        inventory.Namespace(
            stack=self,
            name="namespace-0001",
        ).master_data(
            inventory_models=[
                inventory.InventoryModel(
                    name='item',
                    initial_capacity=100,
                    max_capacity=999,
                    item_models=[
                        inventory.ItemModel(
                            name='item-0001',
                            stacking_limit=99,
                            allow_multiple_stacks=False,
                            sort_value=1,
                            options=inventory.ItemModelOptions(
                                metadata='ITEM_0001',
                            ),
                        ),
                        inventory.ItemModel(
                            name='item-0002',
                            stacking_limit=49,
                            allow_multiple_stacks=True,
                            sort_value=2,
                            options=inventory.ItemModelOptions(
                                metadata='ITEM_0002',
                            ),
                        ),
                        inventory.ItemModel(
                            name='item-0003',
                            stacking_limit=9,
                            allow_multiple_stacks=False,
                            sort_value=3,
                            options=inventory.ItemModelOptions(
                                metadata='ITEM_0003',
                            ),
                        ),
                    ],
                    options=inventory.InventoryModelOptions(
                        metadata = 'INVENTORY_ITEM'
                    ),
                ),
                inventory.InventoryModel(
                    name='character',
                    initial_capacity=50,
                    max_capacity=99,
                    item_models=[
                        inventory.ItemModel(
                            name='character-0001',
                            stacking_limit=99,
                            allow_multiple_stacks=False,
                            sort_value=1,
                            options=inventory.ItemModelOptions(
                                metadata='CHARACTER_0001',
                            ),
                        ),
                        inventory.ItemModel(
                            name='character-0002',
                            stacking_limit=49,
                            allow_multiple_stacks=True,
                            sort_value=2,
                            options=inventory.ItemModelOptions(
                                metadata='CHARACTER_0002',
                            ),
                        ),
                        inventory.ItemModel(
                            name='character-0003',
                            stacking_limit=9,
                            allow_multiple_stacks=False,
                            sort_value=3,
                            options=inventory.ItemModelOptions(
                                metadata='CHARACTER_0003',
                            ),
                        ),
                    ],
                    options=inventory.InventoryModelOptions(
                        metadata = 'INVENTORY_CHARACTER'
                    ),
                ),
            ],
            simple_inventory_models=[
                inventory.SimpleInventoryModel(
                    name='item',
                    simple_item_models=[
                        inventory.SimpleItemModel(
                            name='item-0001',
                            options=inventory.SimpleItemModelOptions(
                                metadata='ITEM_0001',
                            ),
                        ),
                        inventory.SimpleItemModel(
                            name='item-0002',
                            options=inventory.SimpleItemModelOptions(
                                metadata='ITEM_0002',
                            ),
                        ),
                        inventory.SimpleItemModel(
                            name='item-0003',
                            options=inventory.SimpleItemModelOptions(
                                metadata='ITEM_0003',
                            ),
                        ),
                    ],
                    options=inventory.SimpleInventoryModelOptions(
                        metadata = 'INVENTORY_ITEM'
                    ),
                ),
            ],
            big_inventory_models=[
                inventory.BigInventoryModel(
                    name='item',
                    big_item_models=[
                        inventory.BigItemModel(
                            name='item-0001',
                            options=inventory.BigItemModelOptions(
                                metadata='ITEM_0001',
                            ),
                        ),
                        inventory.BigItemModel(
                            name='item-0002',
                            options=inventory.BigItemModelOptions(
                                metadata='ITEM_0002',
                            ),
                        ),
                        inventory.BigItemModel(
                            name='item-0003',
                            options=inventory.BigItemModelOptions(
                                metadata='ITEM_0003',
                            ),
                        ),
                    ],
                    options=inventory.BigInventoryModelOptions(
                        metadata = 'INVENTORY_ITEM'
                    ),
                ),
            ],
        )

print(SampleStack().yaml())  # Generate Template

```


#### InventoryModel

インベントリモデル<br>

インベントリはゲームプレイヤーが所有しているアイテムを格納するカバンのようなものです。<br>
インベントリには容量が設定でき、容量を超えては所有できません。

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| inventoryModelId | string |  | ※ |  |  ~ 1024文字 | インベントリモデルGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | インベントリモデル名<br>インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| metadata | string |  |  |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
| initialCapacity | int |  | ✓ |  | 0 ~ 2147483646 | 初期サイズ<br>インベントリが初めて作成される際にユーザーに提供されるインベントリ枠の数です。各枠には1つのアイテムスタックを格納できます。ユーザーはゲームプレイのアクションを通じてmaxCapacityまで容量を拡張できます。 |
| maxCapacity | int |  | ✓ |  | 0 ~ 2147483646 | 最大サイズ<br>ユーザーが拡張可能なインベントリ枠の上限値です。この値を超えて容量を増やすことはできません。すべての枠が使用中でアイテムをこれ以上スタックできない場合、オーバーフロースクリプトが超過分を処理しない限り、入手は失敗します。 |
| protectReferencedItem | bool? |  |  | false |  | 参照元保護<br>有効にすると、（referenceOf メカニズムで）参照元が登録されているアイテムセットは消費または削除できなくなります。他のシステムで使用中のアイテム（例：装備中のギア、編成にバインドされたアイテム）が誤って削除されることを防ぎます。 |
| itemModels | [List&lt;ItemModel&gt;](#itemmodel) |  |  | [] | 1 ~ 1000 items | アイテムモデル一覧<br>このインベントリに格納可能なアイテムの種類です。各アイテムモデルは1種類のアイテムのスタックおよび入手動作を定義します。インベントリモデルあたり最大1000アイテムモデルです。 |

#### ItemModel

アイテムモデル<br>

アイテムは、ポーション ×99 のように、1つのインベントリ枠に複数個まとめて所持できます。<br>
このように 1枠に複数個まとめることを「スタック」 と呼び、アイテムごとに スタックできる上限数 を設定できます。<br>

スタック上限に達した場合の挙動もアイテムごとに設定できます。<br>
具体的には、以下のどちらかを選べます：<br>

- 新しいインベントリ枠を追加して、さらに所持できるようにする<br>
- 上限に達したため、これ以上入手できないようにする

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| itemModelId | string |  | ※ |  |  ~ 1024文字 | アイテムモデルGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | アイテムモデル名<br>アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| metadata | string |  |  |  |  ~ 2048文字 | メタデータ<br>GS2-EnhanceにはGS2-Inventoryと連携して強化を行う仕組みがあり、ItemModelのメタデータにJSON形式で、強化素材として使用した場合の経験値量を設定します。<br>詳細は [マイクロサービス紹介 / GS2-Enhance](/microservices/enhance/#強化レート) の項で解説しています。 |
| stackingLimit | long |  | ✓ |  | 1 ~ 9223372036854775805 | スタック可能な最大数量<br>1つのインベントリ枠（スタック）に保持できるこのアイテムの最大数です。この上限に達した場合の動作はallowMultipleStacks設定に依存し、新しい枠が割り当てられるか、それ以上の入手がブロックされます。 |
| allowMultipleStacks | bool |  | ✓ |  |  | 複数スタック許可<br>有効にすると、スタック上限に達した場合に新しいインベントリ枠が自動的に割り当てられ、このアイテムの追加数量を格納します（追加の容量を消費します）。無効の場合、既存の枠でスタック上限に達すると入手がブロックされます。 |
| sortValue | int |  | ✓ |  | 0 ~ 2147483646 | 表示順番<br>インベントリ内のアイテムを表示用にソートするための数値です。値が小さいほど先に表示されます。この値はItemSetレコードにもコピーされ、所持アイテムの一貫した順序付けを可能にします。 |

#### SimpleInventoryModel

シンプルインベントリモデル<br>

通常の InventoryModel では、インベントリ内に格納できるアイテムの容量制限ができました。<br>
しかし、シンプルインベントリ ではそのような機能はなく、単純にアイテムの所持数量を保持するのみとなります。<br>

ただし、シンプルインベントリでは、複数のアイテムの増減処理を1回の処理で実行可能なAPIが利用できます。

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| inventoryModelId | string |  | ※ |  |  ~ 1024文字 | シンプルインベントリモデルGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | シンプルインベントリモデル名<br>シンプルインベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| metadata | string |  |  |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
| simpleItemModels | [List&lt;SimpleItemModel&gt;](#simpleitemmodel) |  |  | [] | 1 ~ 1000 items | シンプルアイテムモデル一覧<br>このシンプルインベントリに格納可能なアイテムの種類です。通常のインベントリと異なり、シンプルアイテムにはスタック上限や容量制約がありません。シンプルインベントリモデルあたり最大1000アイテムモデルです。 |

#### SimpleItemModel

シンプルアイテムモデル<br>

ItemModel では、スタックできる数量の最大値を設定でき、一定数を超える場合は複数のスタックに分けるような実装が可能でした。<br>
シンプルアイテム にはそのような機能はなく、単純にアイテムの所持数量を保持するのみとなります。

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| itemModelId | string |  | ※ |  |  ~ 1024文字 | シンプルアイテムモデルGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | シンプルアイテムモデル名<br>シンプルアイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| metadata | string |  |  |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |

#### BigInventoryModel

巨大インベントリモデル<br>

通常の InventoryModel や SimpleInventoryModel では、インベントリに格納できるアイテムの数は int64 の範囲に限られました。<br>
インフレ系ゲームでは、もっと広い値の範囲を必要とする場合があります。<br>

巨大インベントリモデルでは、インベントリに格納できるアイテムの数には1024桁の整数値を持たせることができます。

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| inventoryModelId | string |  | ※ |  |  ~ 1024文字 | 巨大インベントリモデルGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | 巨大インベントリモデル名<br>巨大インベントリモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| metadata | string |  |  |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
| bigItemModels | [List&lt;BigItemModel&gt;](#bigitemmodel) |  |  | [] | 1 ~ 1000 items | 巨大アイテムモデル一覧<br>この巨大インベントリに格納可能なアイテムの種類です。各巨大アイテムモデルは最大1024桁の整数文字列として表される数量を保持できます。巨大インベントリモデルあたり最大1000アイテムモデルです。 |

#### BigItemModel

巨大アイテムモデル<br>

巨大アイテムモデルは、巨大インベントリモデルに格納される巨大アイテムを定義するモデルです。<br>
巨大アイテムは、所持数量を int64 の範囲を超えて保持することができます。

|  | 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- | --- |
| itemModelId | string |  | ※ |  |  ~ 1024文字 | 巨大アイテムモデルGRN<br>※ サーバーが自動で設定 |
| name | string |  | ✓ |  |  ~ 128文字 | 巨大アイテムモデル名<br>巨大アイテムモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 |
| metadata | string |  |  |  |  ~ 2048文字 | メタデータ<br>メタデータには任意の値を設定できます。<br>これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |

---



