// Copyright 2025 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 google.cloud.networksecurity.v1alpha1;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.NetworkSecurity.V1Alpha1";
option go_package = "cloud.google.com/go/networksecurity/apiv1alpha1/networksecuritypb;networksecuritypb";
option java_multiple_files = true;
option java_outer_classname = "UrlListProto";
option java_package = "com.google.cloud.networksecurity.v1alpha1";
option php_namespace = "Google\\Cloud\\NetworkSecurity\\V1alpha1";
option ruby_package = "Google::Cloud::NetworkSecurity::V1alpha1";

// UrlList proto helps users to set reusable, independently manageable lists
// of hosts, host patterns, URLs, URL patterns.
message UrlList {
  option (google.api.resource) = {
    type: "networksecurity.googleapis.com/UrlList"
    pattern: "projects/{project}/locations/{location}/urlLists/{url_list}"
  };

  // Required. Name of the resource provided by the user.
  // Name is of the form
  // projects/{project}/locations/{location}/urlLists/{url_list}
  // url_list should match the
  // pattern:(^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$).
  string name = 1 [(google.api.field_behavior) = REQUIRED];

  // Output only. Time when the security policy was created.
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when the security policy was updated.
  google.protobuf.Timestamp update_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Free-text description of the resource.
  string description = 4 [(google.api.field_behavior) = OPTIONAL];

  // Required. FQDNs and URLs.
  repeated string values = 5 [(google.api.field_behavior) = REQUIRED];
}

// Request used by the ListUrlList method.
message ListUrlListsRequest {
  // Required. The project and location from which the UrlLists should
  // be listed, specified in the format
  // `projects/{project}/locations/{location}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "locations.googleapis.com/Location"
    }
  ];

  // Maximum number of UrlLists to return per call.
  int32 page_size = 2;

  // The value returned by the last `ListUrlListsResponse`
  // Indicates that this is a continuation of a prior
  // `ListUrlLists` call, and that the system
  // should return the next page of data.
  string page_token = 3;
}

// Response returned by the ListUrlLists method.
message ListUrlListsResponse {
  // List of UrlList resources.
  repeated UrlList url_lists = 1;

  // If there might be more results than those appearing in this response, then
  // `next_page_token` is included. To get the next set of results, call this
  // method again using the value of `next_page_token` as `page_token`.
  string next_page_token = 2;

  // Locations that could not be reached.
  repeated string unreachable = 3;
}

// Request used by the GetUrlList method.
message GetUrlListRequest {
  // Required. A name of the UrlList to get. Must be in the format
  // `projects/*/locations/{location}/urlLists/*`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "networksecurity.googleapis.com/UrlList"
    }
  ];
}

// Request used by the CreateUrlList method.
message CreateUrlListRequest {
  // Required. The parent resource of the UrlList. Must be in
  // the format `projects/*/locations/{location}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "networksecurity.googleapis.com/UrlList"
    }
  ];

  // Required. Short name of the UrlList resource to be created. This value
  // should be 1-63 characters long, containing only letters, numbers, hyphens,
  // and underscores, and should not start with a number. E.g. "url_list".
  string url_list_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. UrlList resource to be created.
  UrlList url_list = 3 [(google.api.field_behavior) = REQUIRED];
}

// Request used by UpdateUrlList method.
message UpdateUrlListRequest {
  // Optional. Field mask is used to specify the fields to be overwritten in the
  // UrlList resource by the update.  The fields
  // specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the
  // mask. If the user does not provide a mask then all fields will be
  // overwritten.
  google.protobuf.FieldMask update_mask = 1
      [(google.api.field_behavior) = OPTIONAL];

  // Required. Updated UrlList resource.
  UrlList url_list = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request used by the DeleteUrlList method.
message DeleteUrlListRequest {
  // Required. A name of the UrlList to delete. Must be in
  // the format `projects/*/locations/{location}/urlLists/*`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "networksecurity.googleapis.com/UrlList"
    }
  ];
}
