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

# GS2-Lottery Deploy/CDK 레퍼런스

GS2-Deploy의 스택을 생성할 때 사용하는 템플릿 포맷과, CDK를 이용한 각종 언어의 템플릿 출력 구현 예제




## 엔티티

Deploy 처리에서 조작 대상이 되는 리소스

### Namespace

네임스페이스<br>

네임스페이스는 하나의 프로젝트 내에서 동일한 서비스를 서로 다른 용도로 여러 개 이용하기 위한 엔티티입니다.<br>
GS2의 각 서비스는 네임스페이스 단위로 관리됩니다. 네임스페이스가 다르면 동일한 서비스라도 완전히 독립된 데이터 공간으로 취급됩니다.<br>

따라서 각 서비스의 이용을 시작하려면 먼저 네임스페이스를 생성해야 합니다.

#### Request

리소스 생성・갱신 요청

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓|  |  ~ 128자 | 네임스페이스 이름<br>네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| description | string |  | |  |  ~ 1024자 | 설명문 |
| transactionSetting | [TransactionSetting](#transactionsetting) |  | ✓|  |  | 트랜잭션 설정<br>추첨 조작 시 트랜잭션의 처리 방법을 제어하는 설정입니다. 추첨에서는 입수 액션을 통해 사용자에게 경품을 지급하는 트랜잭션이 발행됩니다. |
| lotteryTriggerScriptId | string |  | |  |  ~ 1024자 | 추첨을 실행했을 때 호출되는 GS2-Script의 스크립트 GRN<br>Script 트리거 레퍼런스 - [`lottery`](../script/#lottery) |
| logSetting | [LogSetting](#logsetting) |  | |  |  | 로그 출력 설정<br>추첨 조작의 API 요청·응답 로그를 출력하기 위한 GS2-Log 네임스페이스를 지정합니다. 디버그 및 분석을 위해 추첨 결과, 경품 배포, 박스 가챠 상태 추적에 유용합니다. |

#### GetAttr

[!GetAttr](/articles/tech/deploy/#getattr) 태그로 취득 가능한 리소스 생성 결과

| | 타입 | 설명 |
| --- | --- | --- |
| Item | [Namespace](../sdk#namespace) | 생성한 네임스페이스

#### 구현 예제




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

Type: GS2::Lottery::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSetting: 
    EnableAutoRun: true
    QueueNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001
  LotteryTriggerScriptId: 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/lottery"
    "github.com/openlyinc/pointy"
)


SampleStack := core.NewStack()
lottery.NewNamespace(
    &SampleStack,
    "namespace-0001",
    lottery.NamespaceOptions{
        TransactionSetting: core.NewTransactionSetting(
            core.TransactionSettingOptions{
                QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"),
            },
        ),
        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\Lottery\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Lottery\Model\Options\NamespaceOptions(
                transactionSetting: new \Gs2Cdk\Core\Model\TransactionSetting(
                    new \Gs2Cdk\Core\Model\TransactionSettingOptions(
                        queueNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
                    )
                ),
                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.lottery.model.Namespace(
                this,
                "namespace-0001",
                new io.gs2.cdk.lottery.model.options.NamespaceOptions()
                        .withTransactionSetting(new io.gs2.cdk.core.model.TransactionSetting(
                            new io.gs2.cdk.core.model.options.TransactionSettingOptions()
                                .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
                        ))
                        .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.Gs2Lottery.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2Lottery.Model.Options.NamespaceOptions
            {
                transactionSetting = new Gs2Cdk.Core.Model.TransactionSetting(
                    options: new Gs2Cdk.Core.Model.TransactionSettingOptions
                    {
                        queueNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
                    }
                ),
                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 lottery from "@/gs2cdk/lottery";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new lottery.model.Namespace(
            this,
            "namespace-0001",
            {
                transactionSetting: new core.TransactionSetting(
                    {
                        queueNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-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, lottery

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        lottery.Namespace(
            stack=self,
            name='namespace-0001',
            options=lottery.NamespaceOptions(
                transaction_setting=core.TransactionSetting(
                    options=core.TransactionSettingOptions(
                        queue_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001',
                    )
                ),
                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 |

#### 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로 지정해야 합니다. |

---

### CurrentLotteryMaster

현재 활성화된 추첨 모델의 마스터 데이터<br>

현재 네임스페이스 내에서 유효한 추첨 모델의 정의를 기술한 마스터 데이터입니다.<br>
GS2에서는 마스터 데이터 관리에 JSON 형식의 파일을 사용합니다.<br>
파일을 업로드하면 실제로 서버에 설정을 반영할 수 있습니다.<br>

JSON 파일을 작성하는 방법으로, 매니지먼트 콘솔 내에 마스터 데이터 에디터를 제공하고 있습니다.<br>
또한 게임 운영에 더 적합한 도구를 직접 제작하여 적절한 포맷의 JSON 파일을 출력하는 방식으로도 서비스를 이용할 수 있습니다.
**ℹ️ Note**

JSON 파일 형식에 대해서는 [GS2-Lottery 마스터 데이터 레퍼런스](api_reference/lottery/master_data/)를 참조해 주세요.

#### Request

리소스 생성・갱신 요청

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128자 | 네임스페이스 이름<br>네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| mode | 문자열 열거형<br>enum {<br>"direct",<br>"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 | [CurrentLotteryMaster](../sdk#currentlotterymaster) | 업데이트된 현재 활성화된 추첨 모델의 마스터 데이터

#### 구현 예제




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

Type: GS2::Lottery::CurrentLotteryMaster
Properties:
  NamespaceName: namespace-0001
  Mode: direct
  Settings: {
    "version": "2019-02-21",
    "lotteryModels": [
      {
        "name": "gacha",
        "mode": "normal",
        "method": "prize_table",
        "metadata": "GACHA",
        "prizeTableName": "gacha"
      },
      {
        "name": "gacha_ssr",
        "mode": "normal",
        "method": "prize_table",
        "metadata": "SSR",
        "prizeTableName": "gacha-ssr"
      },
      {
        "name": "gacha_sr",
        "mode": "normal",
        "method": "prize_table",
        "metadata": "SR",
        "prizeTableName": "gacha-sr"
      },
      {
        "name": "gacha_r",
        "mode": "normal",
        "method": "prize_table",
        "metadata": "R",
        "prizeTableName": "gacha-r"
      },
      {
        "name": "box",
        "mode": "box",
        "method": "prize_table",
        "metadata": "BOX",
        "prizeTableName": "box"
      }
    ],
    "prizeTables": [
      {
        "name": "gacha",
        "prizes": [
          {
            "prizeId": "prize-1",
            "type": "prize_table",
            "prizeTableName": "gacha-ssr",
            "weight": 5
          },
          {
            "prizeId": "prize-2",
            "type": "prize_table",
            "prizeTableName": "gacha-sr",
            "weight": 15
          },
          {
            "prizeId": "prize-3",
            "type": "prize_table",
            "prizeTableName": "gacha-r",
            "weight": 80
          }
        ],
        "metadata": "SSR"
      },
      {
        "name": "gacha-ssr",
        "prizes": [
          {
            "prizeId": "prize-4",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 1
          },
          {
            "prizeId": "prize-5",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 2
          },
          {
            "prizeId": "prize-6",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 3
          }
        ],
        "metadata": "SSR"
      },
      {
        "name": "gacha-sr",
        "prizes": [
          {
            "prizeId": "prize-7",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 10
          },
          {
            "prizeId": "prize-8",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 20
          },
          {
            "prizeId": "prize-9",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 30
          }
        ],
        "metadata": "SR"
      },
      {
        "name": "gacha-r",
        "prizes": [
          {
            "prizeId": "prize-10",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 100
          },
          {
            "prizeId": "prize-11",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 200
          },
          {
            "prizeId": "prize-12",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 300
          }
        ],
        "metadata": "R"
      },
      {
        "name": "box",
        "prizes": [
          {
            "prizeId": "prize-13",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 30
          },
          {
            "prizeId": "prize-14",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 20
          },
          {
            "prizeId": "prize-15",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": {
                  "namespaceName": "namespace-0001",
                  "slot": 0,
                  "price": 100,
                  "count": 1,
                  "userId": "#{userId}"
                }
              }
            ],
            "weight": 10
          }
        ],
        "metadata": "BOX"
      }
    ]
  }
  UploadToken: null

```

**Go**
```go

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


SampleStack := core.NewStack()
lottery.NewNamespace(
    &SampleStack,
    "namespace-0001",
    lottery.NamespaceOptions{},
).MasterData(
    []lottery.LotteryModel{
        lottery.NewLotteryModel(
            "gacha",
            lottery.LotteryModelModeNormal,
            lottery.LotteryModelMethodPrizeTable,
            lottery.LotteryModelOptions{
                Metadata: pointy.String("GACHA"),
                PrizeTableName: pointy.String("gacha"),
            },
        ),
        lottery.NewLotteryModel(
            "gacha_ssr",
            lottery.LotteryModelModeNormal,
            lottery.LotteryModelMethodPrizeTable,
            lottery.LotteryModelOptions{
                Metadata: pointy.String("SSR"),
                PrizeTableName: pointy.String("gacha-ssr"),
            },
        ),
        lottery.NewLotteryModel(
            "gacha_sr",
            lottery.LotteryModelModeNormal,
            lottery.LotteryModelMethodPrizeTable,
            lottery.LotteryModelOptions{
                Metadata: pointy.String("SR"),
                PrizeTableName: pointy.String("gacha-sr"),
            },
        ),
        lottery.NewLotteryModel(
            "gacha_r",
            lottery.LotteryModelModeNormal,
            lottery.LotteryModelMethodPrizeTable,
            lottery.LotteryModelOptions{
                Metadata: pointy.String("R"),
                PrizeTableName: pointy.String("gacha-r"),
            },
        ),
        lottery.NewLotteryModel(
            "box",
            lottery.LotteryModelModeBox,
            lottery.LotteryModelMethodPrizeTable,
            lottery.LotteryModelOptions{
                Metadata: pointy.String("BOX"),
                PrizeTableName: pointy.String("box"),
            },
        ),
    },
    []lottery.PrizeTable{
        lottery.NewPrizeTable(
            "gacha",
            []lottery.Prize{
                lottery.NewPrize(
                    "prize-1",
                    lottery.PrizeTypePrizeTable,
                    5,
                    lottery.PrizeOptions{
                        PrizeTableName: pointy.String("gacha-ssr"),
                    },
                ),
                lottery.NewPrize(
                    "prize-2",
                    lottery.PrizeTypePrizeTable,
                    15,
                    lottery.PrizeOptions{
                        PrizeTableName: pointy.String("gacha-sr"),
                    },
                ),
                lottery.NewPrize(
                    "prize-3",
                    lottery.PrizeTypePrizeTable,
                    80,
                    lottery.PrizeOptions{
                        PrizeTableName: pointy.String("gacha-r"),
                    },
                ),
            },
            lottery.PrizeTableOptions{
                Metadata: pointy.String("SSR"),
            },
        ),
        lottery.NewPrizeTable(
            "gacha-ssr",
            []lottery.Prize{
                lottery.NewPrize(
                    "prize-4",
                    lottery.PrizeTypeAction,
                    1,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-5",
                    lottery.PrizeTypeAction,
                    2,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-6",
                    lottery.PrizeTypeAction,
                    3,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
            },
            lottery.PrizeTableOptions{
                Metadata: pointy.String("SSR"),
            },
        ),
        lottery.NewPrizeTable(
            "gacha-sr",
            []lottery.Prize{
                lottery.NewPrize(
                    "prize-7",
                    lottery.PrizeTypeAction,
                    10,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-8",
                    lottery.PrizeTypeAction,
                    20,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-9",
                    lottery.PrizeTypeAction,
                    30,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
            },
            lottery.PrizeTableOptions{
                Metadata: pointy.String("SR"),
            },
        ),
        lottery.NewPrizeTable(
            "gacha-r",
            []lottery.Prize{
                lottery.NewPrize(
                    "prize-10",
                    lottery.PrizeTypeAction,
                    100,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-11",
                    lottery.PrizeTypeAction,
                    200,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-12",
                    lottery.PrizeTypeAction,
                    300,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
            },
            lottery.PrizeTableOptions{
                Metadata: pointy.String("R"),
            },
        ),
        lottery.NewPrizeTable(
            "box",
            []lottery.Prize{
                lottery.NewPrize(
                    "prize-13",
                    lottery.PrizeTypeAction,
                    30,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-14",
                    lottery.PrizeTypeAction,
                    20,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
                lottery.NewPrize(
                    "prize-15",
                    lottery.PrizeTypeAction,
                    10,
                    lottery.PrizeOptions{
                        AcquireActions: []core.AcquireAction{
                            money.DepositByUserId(
                                "namespace-0001",
                                0,
                                100,
                                1,
                            ),
                        },
                    },
                ),
            },
            lottery.PrizeTableOptions{
                Metadata: pointy.String("BOX"),
            },
        ),
    },
)

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

```

**PHP**
```php

class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Lottery\Model\Namespace_(
            stack: $this,
            name: "namespace-0001"
        ))->masterData(
            [
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"gacha",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::NORMAL,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"GACHA",
                        prizeTableName:"gacha"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"gacha_ssr",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::NORMAL,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"SSR",
                        prizeTableName:"gacha-ssr"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"gacha_sr",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::NORMAL,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"SR",
                        prizeTableName:"gacha-sr"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"gacha_r",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::NORMAL,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"R",
                        prizeTableName:"gacha-r"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"box",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::BOX,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"BOX",
                        prizeTableName:"box"
                    )
                )
            ],
            [
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"gacha",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-1",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::PRIZE_TABLE,
                            weight: 5,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                prizeTableName: "gacha-ssr",
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-2",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::PRIZE_TABLE,
                            weight: 15,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                prizeTableName: "gacha-sr",
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-3",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::PRIZE_TABLE,
                            weight: 80,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                prizeTableName: "gacha-r",
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"SSR"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"gacha-ssr",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-4",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 1,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-5",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 2,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-6",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 3,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"SSR"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"gacha-sr",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-7",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 10,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-8",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 20,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-9",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 30,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"SR"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"gacha-r",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-10",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 100,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-11",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 200,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-12",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 300,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"R"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"box",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-13",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 30,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-14",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 20,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId: "prize-15",
                            type: \Gs2Cdk\Lottery\Model\Enums\PrizeType::ACTION,
                            weight: 10,
                            options: new \Gs2Cdk\Lottery\Model\Options\PrizeOptions(
                                acquireActions: [
                                    new \Gs2Cdk\Money\StampSheet\DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"BOX"
                    )
                )
            ]
        );
    }
}

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

```

**Java**
```java

class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.lottery.model.Namespace(
            this,
            "namespace-0001"
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "gacha",
                    io.gs2.cdk.lottery.model.enums.LotteryModelMode.NORMAL,
                    io.gs2.cdk.lottery.model.enums.LotteryModelMethod.PRIZE_TABLE,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                        .withMetadata("GACHA")
                        .withPrizeTableName("gacha")
                ),
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "gacha_ssr",
                    io.gs2.cdk.lottery.model.enums.LotteryModelMode.NORMAL,
                    io.gs2.cdk.lottery.model.enums.LotteryModelMethod.PRIZE_TABLE,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                        .withMetadata("SSR")
                        .withPrizeTableName("gacha-ssr")
                ),
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "gacha_sr",
                    io.gs2.cdk.lottery.model.enums.LotteryModelMode.NORMAL,
                    io.gs2.cdk.lottery.model.enums.LotteryModelMethod.PRIZE_TABLE,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                        .withMetadata("SR")
                        .withPrizeTableName("gacha-sr")
                ),
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "gacha_r",
                    io.gs2.cdk.lottery.model.enums.LotteryModelMode.NORMAL,
                    io.gs2.cdk.lottery.model.enums.LotteryModelMethod.PRIZE_TABLE,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                        .withMetadata("R")
                        .withPrizeTableName("gacha-r")
                ),
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "box",
                    io.gs2.cdk.lottery.model.enums.LotteryModelMode.BOX,
                    io.gs2.cdk.lottery.model.enums.LotteryModelMethod.PRIZE_TABLE,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                        .withMetadata("BOX")
                        .withPrizeTableName("box")
                )
            ),
            Arrays.asList(
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "gacha",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-1",
                            io.gs2.cdk.lottery.model.enums.PrizeType.PRIZE_TABLE,
                            5,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withPrizeTableName("gacha-ssr")
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-2",
                            io.gs2.cdk.lottery.model.enums.PrizeType.PRIZE_TABLE,
                            15,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withPrizeTableName("gacha-sr")
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-3",
                            io.gs2.cdk.lottery.model.enums.PrizeType.PRIZE_TABLE,
                            80,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withPrizeTableName("gacha-r")
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                        .withMetadata("SSR")
                ),
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "gacha-ssr",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-4",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            1,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-5",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            2,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-6",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            3,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                        .withMetadata("SSR")
                ),
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "gacha-sr",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-7",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            10,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-8",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            20,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-9",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            30,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                        .withMetadata("SR")
                ),
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "gacha-r",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-10",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            100,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-11",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            200,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-12",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            300,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                        .withMetadata("R")
                ),
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "box",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-13",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            30,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-14",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            20,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            "prize-15",
                            io.gs2.cdk.lottery.model.enums.PrizeType.ACTION,
                            10,
                            new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions(Arrays.asList(
                                    new io.gs2.cdk.money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100f,
                                        1,
                                        "#{userId}"
                                    )
                                ))
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                        .withMetadata("BOX")
                )
            )
        );
    }
}

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

```

**C#**
```csharp

public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Lottery.Model.Namespace(
            stack: this,
            name: "namespace-0001"
        ).MasterData(
            new Gs2Cdk.Gs2Lottery.Model.LotteryModel[] {
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    name: "gacha",
                    mode: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Normal,
                    method: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions
                    {
                        metadata = "GACHA",
                        prizeTableName = "gacha"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    name: "gacha_ssr",
                    mode: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Normal,
                    method: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions
                    {
                        metadata = "SSR",
                        prizeTableName = "gacha-ssr"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    name: "gacha_sr",
                    mode: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Normal,
                    method: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions
                    {
                        metadata = "SR",
                        prizeTableName = "gacha-sr"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    name: "gacha_r",
                    mode: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Normal,
                    method: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions
                    {
                        metadata = "R",
                        prizeTableName = "gacha-r"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    name: "box",
                    mode: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Box,
                    method: Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.LotteryModelOptions
                    {
                        metadata = "BOX",
                        prizeTableName = "box"
                    }
                )
            },
            new Gs2Cdk.Gs2Lottery.Model.PrizeTable[] {
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    name: "gacha",
                    prizes: new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-1",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.PrizeTable,
                            weight: 5,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                prizeTableName = "gacha-ssr"
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-2",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.PrizeTable,
                            weight: 15,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                prizeTableName = "gacha-sr"
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-3",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.PrizeTable,
                            weight: 80,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                prizeTableName = "gacha-r"
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions
                    {
                        metadata = "SSR"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    name: "gacha-ssr",
                    prizes: new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-4",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 1,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-5",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 2,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-6",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 3,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions
                    {
                        metadata = "SSR"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    name: "gacha-sr",
                    prizes: new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-7",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 10,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-8",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 20,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-9",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 30,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions
                    {
                        metadata = "SR"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    name: "gacha-r",
                    prizes: new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-10",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 100,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-11",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 200,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-12",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 300,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions
                    {
                        metadata = "R"
                    }
                ),
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    name: "box",
                    prizes: new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-13",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 30,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-14",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 20,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-15",
                            type: Gs2Cdk.Gs2Lottery.Model.Enums.PrizeType.Action,
                            weight: 10,
                            options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeOptions
                            {
                                acquireActions = new Gs2Cdk.Core.Model.AcquireAction[]
                                {
                                    new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
                                        namespaceName: "namespace-0001",
                                        slot: 0,
                                        price: 100,
                                        count: 1,
                                        userId: "#{userId}"
                                    )
                                }
                            }
                        )
                    },
                    options: new Gs2Cdk.Gs2Lottery.Model.Options.PrizeTableOptions
                    {
                        metadata = "BOX"
                    }
                )
            }
        );
    }
}

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

```

**TypeScript**
```typescript

import core from "@/gs2cdk/core";
import lottery from "@/gs2cdk/lottery";
import money from "@/gs2cdk/money";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new lottery.model.Namespace(
            this,
            "namespace-0001",
        ).masterData(
            [
                new lottery.model.LotteryModel(
                    "gacha",
                    lottery.model.LotteryModelMode.NORMAL,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "GACHA",
                        prizeTableName: "gacha"
                    }
                ),
                new lottery.model.LotteryModel(
                    "gacha_ssr",
                    lottery.model.LotteryModelMode.NORMAL,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "SSR",
                        prizeTableName: "gacha-ssr"
                    }
                ),
                new lottery.model.LotteryModel(
                    "gacha_sr",
                    lottery.model.LotteryModelMode.NORMAL,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "SR",
                        prizeTableName: "gacha-sr"
                    }
                ),
                new lottery.model.LotteryModel(
                    "gacha_r",
                    lottery.model.LotteryModelMode.NORMAL,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "R",
                        prizeTableName: "gacha-r"
                    }
                ),
                new lottery.model.LotteryModel(
                    "box",
                    lottery.model.LotteryModelMode.BOX,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "BOX",
                        prizeTableName: "box"
                    }
                )
            ],
            [
                new lottery.model.PrizeTable(
                    "gacha",
                    [
                        new lottery.model.Prize(
                            "prize-1",
                            lottery.model.PrizeType.PRIZE_TABLE,
                            5,
                            {
                                prizeTableName: "gacha-ssr"
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-2",
                            lottery.model.PrizeType.PRIZE_TABLE,
                            15,
                            {
                                prizeTableName: "gacha-sr"
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-3",
                            lottery.model.PrizeType.PRIZE_TABLE,
                            80,
                            {
                                prizeTableName: "gacha-r"
                            }
                        ),
                    ],
                    {
                        metadata: "SSR"
                    }
                ),
                new lottery.model.PrizeTable(
                    "gacha-ssr",
                    [
                        new lottery.model.Prize(
                            "prize-4",
                            lottery.model.PrizeType.ACTION,
                            1,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-5",
                            lottery.model.PrizeType.ACTION,
                            2,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-6",
                            lottery.model.PrizeType.ACTION,
                            3,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                    ],
                    {
                        metadata: "SSR"
                    }
                ),
                new lottery.model.PrizeTable(
                    "gacha-sr",
                    [
                        new lottery.model.Prize(
                            "prize-7",
                            lottery.model.PrizeType.ACTION,
                            10,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-8",
                            lottery.model.PrizeType.ACTION,
                            20,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-9",
                            lottery.model.PrizeType.ACTION,
                            30,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                    ],
                    {
                        metadata: "SR"
                    }
                ),
                new lottery.model.PrizeTable(
                    "gacha-r",
                    [
                        new lottery.model.Prize(
                            "prize-10",
                            lottery.model.PrizeType.ACTION,
                            100,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-11",
                            lottery.model.PrizeType.ACTION,
                            200,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-12",
                            lottery.model.PrizeType.ACTION,
                            300,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                    ],
                    {
                        metadata: "R"
                    }
                ),
                new lottery.model.PrizeTable(
                    "box",
                    [
                        new lottery.model.Prize(
                            "prize-13",
                            lottery.model.PrizeType.ACTION,
                            30,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-14",
                            lottery.model.PrizeType.ACTION,
                            20,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                        new lottery.model.Prize(
                            "prize-15",
                            lottery.model.PrizeType.ACTION,
                            10,
                            {
                                acquireActions: [
                                    new money.stampSheet.DepositByUserId(
                                        "namespace-0001",
                                        0,
                                        100,
                                        1,
                                        null,
                                        "#{userId}"
                                    ),
                                ]
                            }
                        ),
                    ],
                    {
                        metadata: "BOX"
                    }
                )
            ]
        );
    }
}

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

```

**Python**
```python

from gs2_cdk import Stack, core, lottery, money

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        lottery.Namespace(
            stack=self,
            name="namespace-0001",
        ).master_data(
            lottery_models=[
                lottery.LotteryModel(
                    name='gacha',
                    mode=lottery.LotteryModelMode.NORMAL,
                    method=lottery.LotteryModelMethod.PRIZE_TABLE,
                    options=lottery.LotteryModelOptions(
                        metadata = 'GACHA',
                        prize_table_name = 'gacha'
                    ),
                ),
                lottery.LotteryModel(
                    name='gacha_ssr',
                    mode=lottery.LotteryModelMode.NORMAL,
                    method=lottery.LotteryModelMethod.PRIZE_TABLE,
                    options=lottery.LotteryModelOptions(
                        metadata = 'SSR',
                        prize_table_name = 'gacha-ssr'
                    ),
                ),
                lottery.LotteryModel(
                    name='gacha_sr',
                    mode=lottery.LotteryModelMode.NORMAL,
                    method=lottery.LotteryModelMethod.PRIZE_TABLE,
                    options=lottery.LotteryModelOptions(
                        metadata = 'SR',
                        prize_table_name = 'gacha-sr'
                    ),
                ),
                lottery.LotteryModel(
                    name='gacha_r',
                    mode=lottery.LotteryModelMode.NORMAL,
                    method=lottery.LotteryModelMethod.PRIZE_TABLE,
                    options=lottery.LotteryModelOptions(
                        metadata = 'R',
                        prize_table_name = 'gacha-r'
                    ),
                ),
                lottery.LotteryModel(
                    name='box',
                    mode=lottery.LotteryModelMode.BOX,
                    method=lottery.LotteryModelMethod.PRIZE_TABLE,
                    options=lottery.LotteryModelOptions(
                        metadata = 'BOX',
                        prize_table_name = 'box'
                    ),
                ),
            ],
            prize_tables=[
                lottery.PrizeTable(
                    name='gacha',
                    prizes=[
                        lottery.Prize(
                            prize_id='prize-1',
                            type=lottery.PrizeType.PRIZE_TABLE,
                            weight=5,
                            options=lottery.PrizeOptions(
                                prize_table_name='gacha-ssr',
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-2',
                            type=lottery.PrizeType.PRIZE_TABLE,
                            weight=15,
                            options=lottery.PrizeOptions(
                                prize_table_name='gacha-sr',
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-3',
                            type=lottery.PrizeType.PRIZE_TABLE,
                            weight=80,
                            options=lottery.PrizeOptions(
                                prize_table_name='gacha-r',
                            ),
                        ),
                    ],
                    options=lottery.PrizeTableOptions(
                        metadata = 'SSR'
                    ),
                ),
                lottery.PrizeTable(
                    name='gacha-ssr',
                    prizes=[
                        lottery.Prize(
                            prize_id='prize-4',
                            type=lottery.PrizeType.ACTION,
                            weight=1,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-5',
                            type=lottery.PrizeType.ACTION,
                            weight=2,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-6',
                            type=lottery.PrizeType.ACTION,
                            weight=3,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options=lottery.PrizeTableOptions(
                        metadata = 'SSR'
                    ),
                ),
                lottery.PrizeTable(
                    name='gacha-sr',
                    prizes=[
                        lottery.Prize(
                            prize_id='prize-7',
                            type=lottery.PrizeType.ACTION,
                            weight=10,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-8',
                            type=lottery.PrizeType.ACTION,
                            weight=20,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-9',
                            type=lottery.PrizeType.ACTION,
                            weight=30,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options=lottery.PrizeTableOptions(
                        metadata = 'SR'
                    ),
                ),
                lottery.PrizeTable(
                    name='gacha-r',
                    prizes=[
                        lottery.Prize(
                            prize_id='prize-10',
                            type=lottery.PrizeType.ACTION,
                            weight=100,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-11',
                            type=lottery.PrizeType.ACTION,
                            weight=200,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-12',
                            type=lottery.PrizeType.ACTION,
                            weight=300,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options=lottery.PrizeTableOptions(
                        metadata = 'R'
                    ),
                ),
                lottery.PrizeTable(
                    name='box',
                    prizes=[
                        lottery.Prize(
                            prize_id='prize-13',
                            type=lottery.PrizeType.ACTION,
                            weight=30,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-14',
                            type=lottery.PrizeType.ACTION,
                            weight=20,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                        lottery.Prize(
                            prize_id='prize-15',
                            type=lottery.PrizeType.ACTION,
                            weight=10,
                            options=lottery.PrizeOptions(
                                acquire_actions=[
                                    money.DepositByUserId(
                                        namespace_name='namespace-0001',
                                        slot=0,
                                        price=100,
                                        count=1,
                                        user_id='#{userId}'
                                    ),
                                ],
                            ),
                        ),
                    ],
                    options=lottery.PrizeTableOptions(
                        metadata = 'BOX'
                    ),
                ),
            ],
        )

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

```


#### PrizeTable

배출 확률 테이블<br>

경품에는 입수 액션을 직접 지정하거나, 다른 배출 확률 테이블을 참조하도록 설정할 수도 있습니다.<br>
배출 확률 테이블을 중첩시키면, 예를 들어 1단계에서 SSR / SR / R 등의 레어도를 추첨하고, 2단계에서 해당 레어도에 대응하는 구체적인 콘텐츠를 추첨하는 등의 설정이 가능합니다.<br>
이 구조를 통해 게임 전체의 레어도별 배출 확률을 관리하고 조정하기가 더 쉬워집니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| prizeTableId | string |  | ※ |  |  ~ 1024자 | 배출 확률 테이블 GRN<br>※ 서버가 자동으로 설정 |
| name | string |  | ✓ |  |  ~ 128자 | 배출 확률 테이블 이름<br>배출 확률 테이블 고유의 이름입니다. 영숫자 및 -(하이픈), _(언더스코어), .(마침표)로 지정합니다. |
| metadata | string |  |  |  |  ~ 128자 | 메타데이터<br>메타데이터에는 임의의 값을 설정할 수 있습니다.<br>이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다. |
| prizes | [List&lt;Prize&gt;](#prize) |  | ✓ |  | 1 ~ 100 items | 경품 리스트<br>이 배출 확률 테이블 내의 경품 리스트입니다. 각 경품은 배출 가중치(확률), 배출 시 실행할 액션, 그리고 선택적으로 배출 횟수 제한을 정의합니다. 각 경품의 실제 배출 확률은 해당 가중치를 테이블 내 전체 경품 가중치의 합으로 나누어 산출됩니다. |

#### Prize

경품<br>

배출 확률 테이블 내 단일 경품 엔트리입니다.<br>
경품은 입수 액션(아이템이나 통화의 부여 등)을 직접 지정하거나, 다른 배출 확률 테이블을 참조하여 중첩된 추첨을 수행할 수 있습니다.<br>
각 경품에는 배출 가중치가 있으며, 배출되는 상대적 확률을 결정합니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| prizeId | string |  | ✓ | UUID |  ~ 36자 | 경품 ID<br>배출 확률 테이블 내에서 이 경품을 고유하게 식별하는 ID입니다. 배출 횟수 제한 추적 및 페일오버 경품 지정 시 참조에 사용됩니다. |
| type | 문자열 열거형<br>enum {<br>"action",<br>"prize_table"<br>}<br> |  | ✓ |  |  | 경품 종류<br>이 경품이 직접 보상을 부여하는지, 다른 배출 확률 테이블에 위임하는지를 결정합니다. "action"은 배출 시 실행할 입수 액션을 지정합니다. "prize_table"은 다른 배출 확률 테이블을 참조하여 중첩된 추첨을 수행합니다(예: 1단계에서 희귀도를 결정하고, 2단계에서 구체적인 아이템을 결정).action: 경품의 입수 액션 / prize_table: 더욱 배출 확률 테이블을 지정하여 재추첨 /  |
| acquireActions | [List&lt;AcquireAction&gt;](#acquireaction) | {type} == "action" |  | [] | 1 ~ 100 items | 입수 액션 리스트<br>이 경품이 배출될 때 실행할 입수 액션의 리스트입니다. 여러 액션을 지정하여 한 번에 여러 보상을 부여할 수 있습니다(예: 아이템과 통화를 동시에 부여).<br>※ type이(가) "action" 이면 활성화 |
| drawnLimit | int | {type} == "action" |  |  | 1 ~ 1000000 | 최대 배출 수<br>이 경품이 전체 사용자를 통틀어 배출될 수 있는 최대 횟수입니다. 제한에 도달하면 대신 페일오버 경품(limitFailOverPrizeId)이 배출됩니다. 잭팟 아이템 등 수량 한정 경품 구현에 사용됩니다.<br>※ type이(가) "action" 이면 활성화 |
| limitFailOverPrizeId | string | {type} == "action" and {drawnLimit} > 0 | ✓※ |  |  ~ 32자 | 제한 시 페일오버 경품 ID<br>이 경품의 배출 횟수 제한(drawnLimit)에 도달했을 때 대신 배출할 경품의 ID입니다. 동일한 배출 확률 테이블 내의 다른 경품을 참조해야 합니다.<br>※ type이(가) "action"이고 drawnLimit이(가) 0 보다 크면 필수 |
| prizeTableName | string | {type} == "prize_table" | ✓※ |  |  ~ 128자 | 배출 확률 테이블의 이름<br>추첨을 위임할 배출 확률 테이블의 이름입니다. 경품 타입이 "prize_table"인 경우 중첩된 추첨에 사용됩니다.<br>※ type이(가) "prize_table" 이면 필수 |
| weight | int |  | ✓ |  | 1 ~ 2147483646 | 배출 가중치<br>배출 확률 테이블 내에서 이 경품의 상대적 가중치입니다. 실제 배출 확률은 이 경품의 가중치를 테이블 내 모든 경품의 가중치 합계로 나누어 산출됩니다. 예를 들어 3개의 경품의 가중치가 각각 70, 20, 10이라면 각각의 배출 확률은 70%, 20%, 10%가 됩니다. |

#### LotteryModel

추첨 모델<br>

추첨 모델은 배출 방식과 배출 테이블의 참조 방법을 정의하는 엔티티입니다.<br>

배출 방식은 2종류가 마련되어 있으며, 일반 추첨은 매번 일정한 확률로 추첨하는 방식이고, 박스 추첨은 상자 안에 미리 정해진 수량의 경품이 들어 있어 추첨할 때마다 상자에서 경품을 꺼내는 추첨 방식입니다.<br>

추첨 처리를 수행할 때 배출 확률 테이블을 사용하는데,<br>
GS2-Script를 사용하면 여러 번 추첨을 실행할 때 배출 확률 테이블 일부만 다른 테이블로 교체할 수 있습니다.<br>
이 구조를 이용하면 10연 가챠에서 1회만 다른 추첨 확률 테이블을 적용하는 것이 가능해집니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| lotteryModelId | string |  | ※ |  |  ~ 1024자 | 추첨 모델 GRN<br>※ 서버가 자동으로 설정 |
| name | string |  | ✓ |  |  ~ 128자 | 추첨 모델 이름<br>추첨 모델 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| metadata | string |  |  |  |  ~ 2048자 | 메타데이터<br>메타데이터에는 임의의 값을 설정할 수 있습니다.<br>이 값들은 GS2의 동작에 영향을 미치지 않으므로, 게임 내에서 사용할 정보를 저장하는 용도로 사용할 수 있습니다. |
| mode | 문자열 열거형<br>enum {<br>"normal",<br>"box"<br>}<br> |  | ✓ |  |  | 추첨 모드<br>경품의 추첨 방식을 선택합니다. "normal"은 매번 일정한 확률로 추첨을 진행합니다(경품은 반복해서 배출됩니다). "box"는 가상의 상자에 미리 정해진 수량의 경품을 넣어두고, 추첨할 때마다 상자에서 경품을 꺼냅니다(모든 경품이 최종적으로 배출되는 것이 보장됩니다).normal: 일반 추첨 / box: 박스 추첨 /  |
| method | 문자열 열거형<br>enum {<br>"prize_table",<br>"script"<br>}<br> |  | ✓ |  |  | 추첨 방법<br>배출 확률 테이블의 참조 방법을 결정합니다. "prize_table"은 정적으로 지정된 배출 확률 테이블을 사용합니다. "script"는 GS2-Script를 사용하여 추첨 시점에 배출 확률 테이블을 동적으로 선택하며, 10연 가챠에서 1회만 다른 배출 확률 테이블을 적용하는 등의 시나리오를 실현할 수 있습니다.prize_table: 정적 배출 확률 테이블 / script: GS2-Script를 사용한 동적 배출 확률 테이블 /  |
| prizeTableName | string | {method} == "prize_table" | ✓※ |  |  ~ 128자 | 배출 확률 테이블 이름<br>이 추첨 모델에서 사용할 배출 확률 테이블의 이름입니다. 추첨 방법이 "prize_table"인 경우 필수입니다.<br>※ method이(가) "prize_table" 이면 필수 |
| choicePrizeTableScriptId | string | {method} == "script" | ✓※ |  |  ~ 1024자 | 배출 확률 테이블을 결정하는 GS2-Script의 스크립트 GRN<br>Script 트리거 레퍼런스 - [`choicePrizeTable`](../script/#choiceprizetable)<br>※ method이(가) "script" 이면 필수 |

#### AcquireAction

입수 액션

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| action | 문자열 열거형<br>enum {<br>}<br> |  | ✓ |  |  | 입수 액션에서 실행할 액션의 종류 |
| request | string |  | ✓ |  |  ~ 524288자 | 액션 실행 시 사용되는 요청의 JSON 문자열 |

---



