var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
    function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
    var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
    var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
    var _, done = false;
    for (var i = decorators.length - 1; i >= 0; i--) {
        var context = {};
        for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
        for (var p in contextIn.access) context.access[p] = contextIn.access[p];
        context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
        var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
        if (kind === "accessor") {
            if (result === void 0) continue;
            if (result === null || typeof result !== "object") throw new TypeError("Object expected");
            if (_ = accept(result.get)) descriptor.get = _;
            if (_ = accept(result.set)) descriptor.set = _;
            if (_ = accept(result.init)) initializers.unshift(_);
        }
        else if (_ = accept(result)) {
            if (kind === "field") initializers.unshift(_);
            else descriptor[key] = _;
        }
    }
    if (target) Object.defineProperty(target, contextIn.name, descriptor);
    done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
    var useValue = arguments.length > 2;
    for (var i = 0; i < initializers.length; i++) {
        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
    }
    return useValue ? value : void 0;
};
import { DeesElement, customElement, html, css, cssManager, property, } from '@design.estate/dees-element';
let SzServicesBackupsView = (() => {
    let _classDecorators = [customElement('sz-services-backups-view')];
    let _classDescriptor;
    let _classExtraInitializers = [];
    let _classThis;
    let _classSuper = DeesElement;
    let _schedules_decorators;
    let _schedules_initializers = [];
    let _schedules_extraInitializers = [];
    let _backups_decorators;
    let _backups_initializers = [];
    let _backups_extraInitializers = [];
    var SzServicesBackupsView = class extends _classSuper {
        static { _classThis = this; }
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            _schedules_decorators = [property({ type: Array })];
            _backups_decorators = [property({ type: Array })];
            __esDecorate(this, null, _schedules_decorators, { kind: "accessor", name: "schedules", static: false, private: false, access: { has: obj => "schedules" in obj, get: obj => obj.schedules, set: (obj, value) => { obj.schedules = value; } }, metadata: _metadata }, _schedules_initializers, _schedules_extraInitializers);
            __esDecorate(this, null, _backups_decorators, { kind: "accessor", name: "backups", static: false, private: false, access: { has: obj => "backups" in obj, get: obj => obj.backups, set: (obj, value) => { obj.backups = value; } }, metadata: _metadata }, _backups_initializers, _backups_extraInitializers);
            __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
            SzServicesBackupsView = _classThis = _classDescriptor.value;
            if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        }
        static demo = () => html `
    <div style="padding: 24px; max-width: 1200px;">
      <sz-services-backups-view
        .schedules=${[
            { id: '1', scope: 'All Services', retention: 'D:7, W:4, M:12', schedule: '0 2 * * *', lastRun: '1/2/2026, 2:00:03 AM', nextRun: '1/3/2026, 2:00:00 AM', status: 'active' },
        ]}
        .backups=${[
            { id: '1', service: 'test-nginx', createdAt: '1/2/2026, 2:00:03 AM', size: '22.0 MB', includes: ['Image'] },
            { id: '2', service: 'hello-world', createdAt: '1/2/2026, 2:00:02 AM', size: '21.5 MB', includes: ['Image'] },
            { id: '3', service: 'test-ch-final', createdAt: '1/2/2026, 2:00:00 AM', size: '22.0 MB', includes: ['Image', 'clickhouse'] },
        ]}
      ></sz-services-backups-view>
    </div>
  `;
        #schedules_accessor_storage = __runInitializers(this, _schedules_initializers, []);
        get schedules() { return this.#schedules_accessor_storage; }
        set schedules(value) { this.#schedules_accessor_storage = value; }
        #backups_accessor_storage = (__runInitializers(this, _schedules_extraInitializers), __runInitializers(this, _backups_initializers, []));
        get backups() { return this.#backups_accessor_storage; }
        set backups(value) { this.#backups_accessor_storage = value; }
        static styles = [
            cssManager.defaultStyles,
            css `
      :host {
        display: block;
      }

      .section {
        background: ${cssManager.bdTheme('#ffffff', '#09090b')};
        border: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
        border-radius: 8px;
        margin-bottom: 24px;
        overflow: hidden;
      }

      .section-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 16px;
        border-bottom: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
      }

      .section-info {
        display: flex;
        flex-direction: column;
        gap: 4px;
      }

      .section-title {
        font-size: 16px;
        font-weight: 600;
        color: ${cssManager.bdTheme('#18181b', '#fafafa')};
      }

      .section-subtitle {
        font-size: 13px;
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
      }

      .header-actions {
        display: flex;
        gap: 8px;
      }

      .action-button {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 14px;
        background: ${cssManager.bdTheme('#ffffff', '#09090b')};
        border: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
        border-radius: 6px;
        font-size: 13px;
        font-weight: 500;
        color: ${cssManager.bdTheme('#18181b', '#fafafa')};
        cursor: pointer;
        transition: all 200ms ease;
      }

      .action-button:hover {
        background: ${cssManager.bdTheme('#f4f4f5', '#18181b')};
      }

      .action-button.primary {
        background: ${cssManager.bdTheme('#18181b', '#fafafa')};
        color: ${cssManager.bdTheme('#fafafa', '#18181b')};
        border: none;
      }

      .action-button.primary:hover {
        opacity: 0.9;
      }

      .table-header {
        display: grid;
        gap: 16px;
        padding: 12px 16px;
        background: ${cssManager.bdTheme('#f4f4f5', '#18181b')};
        border-bottom: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
      }

      .schedules-header {
        grid-template-columns: 1fr 1fr 1fr 1.5fr 1.5fr 80px 120px;
      }

      .backups-header {
        grid-template-columns: 1.5fr 1.5fr 100px 1fr 120px;
      }

      .table-row {
        display: grid;
        gap: 16px;
        padding: 12px 16px;
        border-bottom: 1px solid ${cssManager.bdTheme('#f4f4f5', '#27272a')};
        font-size: 14px;
        color: ${cssManager.bdTheme('#18181b', '#fafafa')};
        align-items: center;
      }

      .schedules-row {
        grid-template-columns: 1fr 1fr 1fr 1.5fr 1.5fr 80px 120px;
      }

      .backups-row {
        grid-template-columns: 1.5fr 1.5fr 100px 1fr 120px;
      }

      .table-row:last-child {
        border-bottom: none;
      }

      .table-row:hover {
        background: ${cssManager.bdTheme('#f4f4f5', '#18181b')};
      }

      .status-badge {
        display: inline-flex;
        align-items: center;
        padding: 2px 8px;
        border-radius: 9999px;
        font-size: 12px;
        font-weight: 500;
      }

      .status-badge.active {
        background: ${cssManager.bdTheme('#dcfce7', 'rgba(34, 197, 94, 0.2)')};
        color: ${cssManager.bdTheme('#16a34a', '#22c55e')};
      }

      .status-badge.failed {
        background: ${cssManager.bdTheme('#fee2e2', 'rgba(239, 68, 68, 0.2)')};
        color: ${cssManager.bdTheme('#dc2626', '#ef4444')};
      }

      .status-badge.disabled {
        background: ${cssManager.bdTheme('#f4f4f5', '#27272a')};
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
      }

      .meta-text {
        font-size: 13px;
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
      }

      .includes-list {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
      }

      .include-badge {
        padding: 2px 8px;
        background: ${cssManager.bdTheme('#dbeafe', 'rgba(59, 130, 246, 0.2)')};
        color: ${cssManager.bdTheme('#2563eb', '#60a5fa')};
        border-radius: 4px;
        font-size: 11px;
        font-weight: 500;
      }

      .row-actions {
        display: flex;
        gap: 4px;
      }

      .icon-button {
        padding: 6px;
        background: transparent;
        border: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
        border-radius: 4px;
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
        cursor: pointer;
        transition: all 200ms ease;
      }

      .icon-button:hover {
        background: ${cssManager.bdTheme('#f4f4f5', '#18181b')};
        color: ${cssManager.bdTheme('#18181b', '#fafafa')};
      }

      .icon-button.danger:hover {
        background: ${cssManager.bdTheme('#fee2e2', 'rgba(239, 68, 68, 0.2)')};
        color: ${cssManager.bdTheme('#dc2626', '#ef4444')};
        border-color: ${cssManager.bdTheme('#fee2e2', 'rgba(239, 68, 68, 0.3)')};
      }
    `,
        ];
        render() {
            return html `
      <div class="section">
        <div class="section-header">
          <div class="section-info">
            <div class="section-title">Backup Schedules</div>
            <div class="section-subtitle">Configure automated backup schedules for your services</div>
          </div>
          <div class="header-actions">
            <button class="action-button" @click=${() => this.handleImport()}>
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
                <polyline points="17 8 12 3 7 8"/>
                <line x1="12" y1="3" x2="12" y2="15"/>
              </svg>
              Import Backup
            </button>
            <button class="action-button primary" @click=${() => this.handleCreateSchedule()}>
              <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                <line x1="12" y1="5" x2="12" y2="19"></line>
                <line x1="5" y1="12" x2="19" y2="12"></line>
              </svg>
              Create Schedule
            </button>
          </div>
        </div>
        <div class="table-header schedules-header">
          <span>Scope</span>
          <span>Retention</span>
          <span>Schedule</span>
          <span>Last Run</span>
          <span>Next Run</span>
          <span>Status</span>
          <span>Actions</span>
        </div>
        ${this.schedules.map(schedule => html `
          <div class="table-row schedules-row">
            <span>${schedule.scope}</span>
            <span class="meta-text" title="Keep: ${schedule.retention}">${schedule.retention}</span>
            <span class="meta-text">${schedule.schedule}</span>
            <span class="meta-text">${schedule.lastRun || '-'}</span>
            <span class="meta-text">${schedule.nextRun || '-'}</span>
            <span>
              <span class="status-badge ${schedule.status}" title="${schedule.error || ''}">
                ${schedule.status === 'active' ? 'Active' : schedule.status === 'failed' ? 'Failed' : 'Disabled'}
              </span>
            </span>
            <span class="row-actions">
              <button class="icon-button" title="Run backup now" @click=${() => this.handleRunNow(schedule)}>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><polygon points="5,3 19,12 5,21"/></svg>
              </button>
              <button class="icon-button" title="${schedule.status === 'disabled' ? 'Enable' : 'Disable'}" @click=${() => this.handleToggle(schedule)}>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                  ${schedule.status === 'disabled'
                ? html `<polyline points="20 6 9 17 4 12"></polyline>`
                : html `<rect x="6" y="6" width="12" height="12" rx="1"/>`}
                </svg>
              </button>
              <button class="icon-button danger" title="Delete" @click=${() => this.handleDeleteSchedule(schedule)}>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                  <polyline points="3,6 5,6 21,6"/><path d="M19,6v14a2,2,0,0,1-2,2H7a2,2,0,0,1-2-2V6m3,0V4a2,2,0,0,1,2-2h4a2,2,0,0,1,2,2v2"/>
                </svg>
              </button>
            </span>
          </div>
        `)}
      </div>

      <div class="section">
        <div class="section-header">
          <div class="section-info">
            <div class="section-title">All Backups</div>
            <div class="section-subtitle">Browse and manage all backups across services</div>
          </div>
        </div>
        <div class="table-header backups-header">
          <span>Service</span>
          <span>Created</span>
          <span>Size</span>
          <span>Includes</span>
          <span>Actions</span>
        </div>
        ${this.backups.map(backup => html `
          <div class="table-row backups-row">
            <span>${backup.service}</span>
            <span class="meta-text">${backup.createdAt}</span>
            <span class="meta-text">${backup.size}</span>
            <span class="includes-list">
              ${backup.includes.map(inc => html `<span class="include-badge">${inc}</span>`)}
            </span>
            <span class="row-actions">
              <button class="icon-button" title="Download backup" @click=${() => this.handleDownload(backup)}>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                  <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
                  <polyline points="7 10 12 15 17 10"/>
                  <line x1="12" y1="15" x2="12" y2="3"/>
                </svg>
              </button>
              <button class="icon-button danger" title="Delete" @click=${() => this.handleDeleteBackup(backup)}>
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                  <polyline points="3,6 5,6 21,6"/><path d="M19,6v14a2,2,0,0,1-2,2H7a2,2,0,0,1-2-2V6m3,0V4a2,2,0,0,1,2-2h4a2,2,0,0,1,2,2v2"/>
                </svg>
              </button>
            </span>
          </div>
        `)}
      </div>
    `;
        }
        handleImport() {
            this.dispatchEvent(new CustomEvent('import', { bubbles: true, composed: true }));
        }
        handleCreateSchedule() {
            this.dispatchEvent(new CustomEvent('create-schedule', { bubbles: true, composed: true }));
        }
        handleRunNow(schedule) {
            this.dispatchEvent(new CustomEvent('run-now', { detail: schedule, bubbles: true, composed: true }));
        }
        handleToggle(schedule) {
            this.dispatchEvent(new CustomEvent('toggle-schedule', { detail: schedule, bubbles: true, composed: true }));
        }
        handleDeleteSchedule(schedule) {
            this.dispatchEvent(new CustomEvent('delete-schedule', { detail: schedule, bubbles: true, composed: true }));
        }
        handleDownload(backup) {
            this.dispatchEvent(new CustomEvent('download', { detail: backup, bubbles: true, composed: true }));
        }
        handleDeleteBackup(backup) {
            this.dispatchEvent(new CustomEvent('delete-backup', { detail: backup, bubbles: true, composed: true }));
        }
        constructor() {
            super(...arguments);
            __runInitializers(this, _backups_extraInitializers);
        }
        static {
            __runInitializers(_classThis, _classExtraInitializers);
        }
    };
    return SzServicesBackupsView = _classThis;
})();
export { SzServicesBackupsView };
//# sourceMappingURL=data:application/json;base64, 