// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package ccc.hosted.marketplace.v2;


option go_package = "google.golang.org/genproto/googleapis/ccc/hosted/marketplace/v2;marketplace";
option java_multiple_files = true;
option java_outer_classname = "ResourcesProto";
option java_package = "com.google.ccc.hosted.marketplace.v2";
option php_namespace = "Google\\Apps\\Market\\V2";

message CustomerLicense {
  message Editions {
    // (Deprecated)
    string edition_id = 405 [deprecated = true];

    // (Deprecated)
    int32 seat_count = 406 [deprecated = true];

    // (Deprecated)
    int32 assigned_seats = 409 [deprecated = true];
  }

  // The type of API resource. This is always appsmarket#customerLicense.
  string kind = 1;

  // The customer's license status. One of:
  //
  // - `ACTIVE`: The customer has a valid license.
  // - `UNLICENSED`: There is no license: either this customer has never
  // installed your application, or else has deleted it.
  string state = 2;

  // The ID of the application corresponding to this license query.
  string application_id = 3;

  // (Deprecated)
  repeated Editions editions = 4 [deprecated = true];

  // The ID of the customer license.
  string id = 101;

  // The domain name of the customer.
  string customer_id = 102;
}

message LicenseNotification {
  message Deletes {
    string kind = 1;

    // (Deprecated)
    string edition_id = 901 [deprecated = true];
  }

  message Expiries {
    string kind = 1;

    // (Deprecated)
    string edition_id = 701 [deprecated = true];
  }

  message Provisions {
    string kind = 1;

    // (Deprecated)
    string edition_id = 601 [deprecated = true];

    // The number of seats that were provisioned.
    int64 seat_count = 602;
  }

  message Reassignments {
    string kind = 1;

    // The email address of the reassigned user.
    string user_id = 801;

    string type = 802;

    // (Deprecated)
    string edition_id = 803 [deprecated = true];
  }

  // The ID of the license notification.
  string id = 1;

  // The ID of the application according to this notification.
  string application_id = 2;

  // The time the event occurred, measuring in milliseconds since the UNIX
  // epoch.
  int64 timestamp = 3;

  // The domain name of the customer corresponding to this notification.
  string customer_id = 4;

  // The type of API resource. This is always appsmarket#licenseNotification.
  string kind = 5;

  // The list of provisioning notifications.
  repeated Provisions provisions = 6;

  // The list of expiry notifications.
  repeated Expiries expiries = 7;

  // The list of reassignment notifications.
  repeated Reassignments reassignments = 8;

  // The list of deletion notifications.
  repeated Deletes deletes = 9;
}

message LicenseNotificationList {
  string kind = 1;

  // The list of notifications. One or more of:
  //
  // - `provisions`: A new license of the application has been provisioned.
  // - `expiries`: A license of the application has expired.
  // - `deletions`: An application has been deleted from a domain.
  // - `reassignments`: An administrator has assigned or revoked a seat license
  // for the application on the provided domain.
  repeated LicenseNotification notifications = 1007;

  // The token used to continue querying for notifications after the final
  // notification in the current result set.
  string next_page_token = 100602;
}

message UserLicense {
  // The type of API resource. This is always appsmarket#userLicense.
  string kind = 1;

  // The domain administrator has activated the application for this domain.
  bool enabled = 2;

  // The user's licensing status. One of:
  //
  // - `ACTIVE`: The user has a valid license and should be permitted to use the
  // application.
  // - `UNLICENSED`: The administrator of this user's domain never assigned a
  // seat for the application to this user.
  // - `EXPIRED`: The administrator assigned a seat to this user, but the
  // license is expired.
  string state = 3;

  // (Deprecated)
  string edition_id = 4 [deprecated = true];

  // The domain name of the user.
  string customer_id = 5;

  // The ID of the application corresponding to the license query.
  string application_id = 6;

  // The ID of user license.
  string id = 101;

  // The email address of the user.
  string user_id = 102;
}
