@page "{id:int}"
@model Admin.Pages.Member.List.ViewModel
@{
    ViewData["Title"] = "회원 상세 관리";
}

<div class="container">
    <h3>@ViewData["Title"]</h3>
    <hr />

    <partial name="_StatusMessage" />

    <!-- 기본 정보 -->
    <div class="row mb-3">
        <label class="col-sm-2">회원 ID</label>
        <div class="col-sm-10">
            @Model.ID
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">SID</label>
        <div class="col-sm-10">
            @Model.SID
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">회원 이메일</label>
        <div class="col-sm-10">
            @Model.Email
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">별명</label>
        <div class="col-sm-10">
            @(Model.Name ?? "-")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">본명</label>
        <div class="col-sm-10">
            @(Model.FullName ?? "-")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">성 / 이름</label>
        <div class="col-sm-10">
            @(Model.FirstName ?? "-") @(Model.LastName ?? "-")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">회원 등급</label>
        <div class="col-sm-10">
            @(Model.GradeName ?? "-")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">성별</label>
        <div class="col-sm-10">
            @(Model.Gender ?? "-")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">생년월일</label>
        <div class="col-sm-10">
            @(Model.Birthday ?? "-")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">연락처</label>
        <div class="col-sm-10">
            @(Model.Phone ?? "-")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">한마디</label>
        <div class="col-sm-10">
            @(string.IsNullOrWhiteSpace(Model.Summary) ? "-" : Model.Summary)
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">자기소개</label>
        <div class="col-sm-10">
            @(string.IsNullOrWhiteSpace(Model.Intro) ? "-" : Model.Intro)
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">구독 중 / 구독자</label>
        <div class="col-sm-10">
            @Model.Following.ToString("N0") / @Model.Followed.ToString("N0")
        </div>
    </div>

    <!-- 상태 -->
    <div class="row mb-3">
        <label class="col-sm-2">이메일 인증</label>
        <div class="col-sm-10">
            @Model.IsEmailVerified
            <span class="text-muted ms-2">@Model.EmailVerifiedAt</span>
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">본인 인증</label>
        <div class="col-sm-10">
            @Model.IsAuthCertified
            <span class="text-muted ms-2">@Model.AuthCertifiedAt</span>
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">차단</label>
        <div class="col-sm-10">
            @Model.IsDenied
            <span class="text-muted ms-2">@Model.DeniedAt</span>
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">운영진</label>
        <div class="col-sm-10">
            @Model.IsAdmin
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">탈퇴</label>
        <div class="col-sm-10">
            @Model.IsWithdraw
            <span class="text-muted ms-2">@Model.DeletedAt</span>
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">크리에이터</label>
        <div class="col-sm-10">
            @Model.IsCreator
        </div>
    </div>

    <!-- 접속/로그 정보 -->
    <div class="row mb-3">
        <label class="col-sm-2">마지막 로그인</label>
        <div class="col-sm-10">
            @(Model.LastLoginAt ?? "-")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">가입 IP</label>
        <div class="col-sm-10">
            @(Model.SignupIP ?? "-")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">마지막 로그인 IP</label>
        <div class="col-sm-10">
            @(Model.LastLoginIp ?? "-")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">IP</label>
        <div class="col-sm-10">
            @(Model.IpAddress ?? "-")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">UserAgent</label>
        <div class="col-sm-10">
            <small class="text-muted">@(Model.UserAgent ?? "-")</small>
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">Device</label>
        <div class="col-sm-10">
            <small class="text-muted">@(Model.DeviceInfo ?? "-")</small>
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">수정 일시</label>
        <div class="col-sm-10">
            @(Model.UpdatedAt ?? "-")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">가입 일시</label>
        <div class="col-sm-10">
            @Model.CreatedAt
        </div>
    </div>

    <hr />

    <h4>지갑 정보</h4>
    <div class="row mb-3">
        <label class="col-sm-2">보유 잔액(P)</label>
        <div class="col-sm-10">
            @Model.Wallet.Balance.ToString("N0")
        </div>
    </div>

    <div class="row mb-3">
        <label class="col-sm-2">출금 가능 금액(P)</label>
        <div class="col-sm-10">
            @Model.Wallet.CreditBalance.ToString("N0")
        </div>
    </div>

    <hr />
    <h4>채널 정보</h4>

    @if (Model.Channel != null) {
        <div class="row mb-2">
            <label class="col-sm-2 col-form-label">채널 SID</label>
            <div class="col-sm-10">
                @Model.Channel.Value.SID
            </div>
        </div>
        <div class="row mb-2">
            <label class="col-sm-2 col-form-label">채널명</label>
            <div class="col-sm-10">
                @Model.Channel.Value.Name
            </div>
        </div>
        <div class="row mb-2">
            <label class="col-sm-2 col-form-label">@@핸들</label>
            <div class="col-sm-10">
                @Model.Channel.Value.Handle
            </div>
        </div>
        <div class="row mb-2">
            <label class="col-sm-2 col-form-label">채널 주소</label>
            <div class="col-sm-10">
                <a href="@Model.Channel.Value.YouTubeUrl" target="_blank" rel="external">@Model.Channel.Value.YouTubeUrl</a>
            </div>
        </div>
    }
    else
    {
        <text>채널을 소유하지 않았습니다.</text>
    }

    <hr />
    <div class="d-grid gap-2 text-center d-md-block">
        <a href="/Member/List?@ViewData["QueryString"]" class="btn btn-secondary">확인</a>
    </div>
    <br />
    <br />
</div>

@section Scripts {
    <script></script>
}
