// Code generated by sidekick. DO NOT EDIT.
//
// Copyright 2026 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
//
//     https://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.

import Foundation
import GoogleCloudWkt

/// A mosaic layout divides the available space into a grid of blocks, and
/// overlays the grid with tiles. Unlike `GridLayout`, tiles may span multiple
/// grid blocks and can be placed at arbitrary locations in the grid.
public struct MosaicLayout: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// The number of columns in the mosaic grid. The number of columns must be
  /// between 1 and 12, inclusive.
  public var columns: Swift.Int32 = Swift.Int32()

  /// The tiles to display.
  public var tiles: [MosaicLayout.Tile] = []

  /// Initialize a new instance of `MosaicLayout`.
  public init() {}

  /// Use `config` to return a new instance of this object, with some fields updated.
  ///
  /// Commonly used to initialize the value, for example:
  ///
  /// ```
  /// let value = MosaicLayout().with { $0.columns = ... }
  /// ```
  public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
    var copy = self
    try config(&copy)
    return copy
  }

  /// A single tile in the mosaic. The placement and size of the tile are
  /// configurable.
  public struct Tile: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The zero-indexed position of the tile in grid blocks relative to the
    /// left edge of the grid. Tiles must be contained within the specified
    /// number of columns. `x_pos` cannot be negative.
    public var xPos: Swift.Int32 = Swift.Int32()

    /// The zero-indexed position of the tile in grid blocks relative to the
    /// top edge of the grid. `y_pos` cannot be negative.
    public var yPos: Swift.Int32 = Swift.Int32()

    /// The width of the tile, measured in grid blocks. Tiles must have a
    /// minimum width of 1.
    public var width: Swift.Int32 = Swift.Int32()

    /// The height of the tile, measured in grid blocks. Tiles must have a
    /// minimum height of 1.
    public var height: Swift.Int32 = Swift.Int32()

    /// The informational widget contained in the tile. For example an `XyChart`.
    public var widget: Widget? = nil

    /// Initialize a new instance of `Tile`.
    public init() {}

    /// Use `config` to return a new instance of this object, with some fields updated.
    ///
    /// Commonly used to initialize the value, for example:
    ///
    /// ```
    /// let value = Tile().with { $0.xPos = ... }
    /// ```
    public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
      var copy = self
      try config(&copy)
      return copy
    }

    public static var _anyTypeUrl: Swift.String {
      return "type.googleapis.com/google.monitoring.dashboard.v1.MosaicLayout.Tile"
    }
    public init(fromAny any: GoogleCloudWkt.`Any`) throws {
      self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
    }
    public func _pack() throws -> GoogleCloudWkt.Struct {
      return try GoogleCloudWkt._slowAnySerialize(message: self)
    }
  }

  public static var _anyTypeUrl: Swift.String {
    return "type.googleapis.com/google.monitoring.dashboard.v1.MosaicLayout"
  }
  public init(fromAny any: GoogleCloudWkt.`Any`) throws {
    self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
  }
  public func _pack() throws -> GoogleCloudWkt.Struct {
    return try GoogleCloudWkt._slowAnySerialize(message: self)
  }
}
